if语句没有意识到car1num和car2num正在改变而只是忽略它们会破坏汽车切换和转向汽车。
确定在game_loop()下面的代码中它表示" car2num = 2 "和" car1num = 1 "后来就说了
span
所以每当你按下RCRTL时,car2num会上升,每次你按下LCRTL,car1num会上升甚至更晚( car1num 和 car2num 都有一个) p>
for event in pygame.event.get():
if crashed == 0:
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_RCTRL:
car2num += 1
if car2num == 4:
car2num = 1
if event.key == pygame.K_LCTRL:
car1num += 1
if car1num == 4:
car1num = 1
那么car1 / 2num的数量决定了这辆车。
但它将始终保持原来设置为" car2num = 2 "和" car1num = 1 "。
感谢您提前提供帮助,并对不起来感到遗憾。
if car2num == 1:
car2IMG = pygame.image.load('textures\car1.png')
if car2num == 2:
car2IMG = pygame.image.load('textures\car2.png')
if car2num == 3:
car2IMG = pygame.image.load('textures\car3.png')
答案 0 :(得分:0)
DO
global car1IMG
global car2IMG
以下
def game_loop()