diff --git a/images/gemgreen.png b/images/gemgreen.png new file mode 100644 index 0000000..82b21fc Binary files /dev/null and b/images/gemgreen.png differ diff --git a/images/playership1_blue.png b/images/playership1_blue.png new file mode 100644 index 0000000..d5670a3 Binary files /dev/null and b/images/playership1_blue.png differ diff --git a/main.py b/main.py index 44d73f2..e88e499 100644 --- a/main.py +++ b/main.py @@ -1,6 +1,35 @@ import pgzrun +import random + WIDTH = 800 HEIGHT = 600 +ship = Actor('playership1_blue') +ship.x = 370 +ship.y = 550 + +gem = Actor('gemgreen') +gem.x = random.randint(20, 780) +gem.y = 0 + +def update(): + if keyboard.left: + ship.x = ship.x - 5 + if keyboard.right: + ship.x = ship.x + 5 + + gem.y = gem.y + 4 + if gem.y > 600: + gem.x = random.randint(20, 780) + gem.y = 0 + if gem.colliderect(ship): + gem.x = random.randint(20, 780) + gem.y = 0 + +def draw(): + screen.fill((80,0,70)) + gem.draw() + ship.draw() + pgzrun.go() # Must be last line \ No newline at end of file