本次练习通过上下左右键分别加载四张不同的照片
代码如下:
import pygame
import os
TIMER_EVENT= pygame.USEREVENT + 2 # 定时器事件
#游戏刷新帧率,每秒40次
FRAME_PER_SEC = 40
SCREEN_RECT = pygame.Rect(0, 0, 1000, 700)
FULLSCREEN = -2147483648
image1_path="./images/image1.jpg"
image2_path="./images/image2.jpg"
image3_path="./images/image3.jpg"
image4_path="./images/image4.jpg"
image1 = pygame.image.load(image1_path)
image2 = pygame.image.load(image2_path)
image3 = pygame.image.load(image3_path)
image4 = pygame.image.load(image4_path)
#将图片统一变为展示大小
image1 = pygame.transform.smoothscale(image1, (500,