我一直在编写一个简单的平台游戏,用户控制一个正方形,并且必须到达窗口的另一边,而不与其他方块碰撞。我想其他4个方块上下跳动,所以我写了以下代码:import pygame
import os
import sys
os.environ['SDL_VIDEO_CENTERED'] = "1"
pygame.init()
#Variables:
width = 600
height = width / 16 * 9
running = True
#Colors
PINK = (255, 79, 161)
BLACK = (0, 0, 0)
BLUE = (0, 0, 255)
clock = pygame.time.Clock()
#MainRectProperties
mainRectX = 0
mainRectY = height / 2 - 20
mainRectSpeed = 250
#RectOneProperties:
rectOneX = 150
rectOneY = 0
#RectTwoPropeties:
rectTwoX = 250
rectTwoY = height - 20
#RectThreeProperties:
rectThreeX = 350
rectThreeY = 0
#RectFourProperties:
rectFourX =