Pygame Zero Help

  SausageMan70
  @SausageMan70
  16:32

I've been coding a game for a while but there seems to be something wrong with the image:  the plane is constantly the "game_over" image and the "colliderect" is not working at allimport random

from time import *

plane = Actor(‘intro’)
cloud1 = Actor(‘cloud’)
cloud2 = Actor(‘cloud2’)
cloud3 = Actor(‘cloud3’)
plane.pos = 250, 250
cloud1.pos = 500, 0
cloud2.pos = 500, 0
cloud3.pos = 500, 0

WIDTH = 500
HEIGHT = 500
SPEED = 3

def draw():
screen.fill((0, 150, 250))
cloud1.draw()
cloud2.draw()
cloud3.draw()
plane.draw()

def on_key_down():
plane.image = (‘plane’)
plane.x = 100

def update():
cloud1.left -= SPEED
cloud2.left -= SPEED
cloud3.left -= SPEED
if cloud1.right < 0:
cloud1.x = 500
reset_cloud1()
elif cloud2.right < 0:
cloud2.x = 500
reset_cloud2()
elif cloud3.right < 0:
cloud3.x = 500
reset_cloud3()
elif plane.y > 450:
plane.y = 450
elif plane.y < 50:
plane.y = 50
elif keyboard.up:
plane.y -= 3
sleep(0.001)
elif keyboard.down:
plane.y += 3
sleep(0.001)
elif plane.colliderect(cloud1) or plane.colliderect(cloud2) or plane.colliderect(cloud3):
plane.x = 250
plane.y = 250
plane.image = (‘game_over’)

def reset_cloud1():
cloud1.y = random.randint(50, 450)
cloud1.x = 500

def reset_cloud2():
cloud2.y = random.randint(50, 450)
cloud2.x = 500

def reset_cloud3():
cloud3.y = random.randint(50, 450)
cloud3.x = 500

1 Like