diff --git a/images/coingold.png b/images/coingold.png new file mode 100644 index 0000000..dff617f Binary files /dev/null and b/images/coingold.png differ diff --git a/images/grass.png b/images/grass.png new file mode 100644 index 0000000..8e2592b Binary files /dev/null and b/images/grass.png differ diff --git a/images/p3_front.png b/images/p3_front.png new file mode 100644 index 0000000..736d240 Binary files /dev/null and b/images/p3_front.png differ diff --git a/images/run__000.png b/images/run__000.png new file mode 100644 index 0000000..5c6954a Binary files /dev/null and b/images/run__000.png differ diff --git a/images/run__002.png b/images/run__002.png new file mode 100644 index 0000000..672a888 Binary files /dev/null and b/images/run__002.png differ diff --git a/images/run__004.png b/images/run__004.png new file mode 100644 index 0000000..821e20e Binary files /dev/null and b/images/run__004.png differ diff --git a/import pgzrun.py b/import pgzrun.py new file mode 100644 index 0000000..bcb4aff --- /dev/null +++ b/import pgzrun.py @@ -0,0 +1,55 @@ +import pgzrun +import random + +WIDTH = 800 +HEIGHT = 600 + +background = Actor('grass') + +player = Actor('p3_front') +player.x = 400 +player.y = 300 + +coin = Actor('coingold') +coin.x = random.randint(0, 800) +coin.y = random.randint(0, 600) + +score = 0 +timer = 10 + +def update(): + global score + global timer + + if timer <= 0: + return + + timer -= 1 / 60 + + if keyboard.up: + player.y -= 5 + if keyboard.down: + player.y += 5 + if keyboard.left: + player.x -= 5 + if keyboard.right: + player.x += 5 + + if player.colliderect(coin): + coin.x = random.randint(0, 800) + coin.y = random.randint(0, 600) + score += 1 + +def draw(): + if timer <= 0: + screen.clear() + screen.draw.text('Game Over', (350,270), color=(255,255,255), fontsize=30) + screen.draw.text('Score: ' + str(score), (350,330), color=(255,255,255), fontsize=30) + else: + background.draw() + player.draw() + coin.draw() + screen.draw.text('Score: ' + str(score), (15,10), color=(255,255,255), fontsize=30) + screen.draw.text('Time: ' + str(round(timer, 2)), (330,10), color=(255,255,255), fontsize=30) + +pgzrun.go() # Must be last line \ No newline at end of file diff --git a/sfx_coin_single1.wav b/sfx_coin_single1.wav new file mode 100644 index 0000000..af5a3e6 Binary files /dev/null and b/sfx_coin_single1.wav differ diff --git a/sfx_sounds_fanfare1.wav b/sfx_sounds_fanfare1.wav new file mode 100644 index 0000000..7531dc3 Binary files /dev/null and b/sfx_sounds_fanfare1.wav differ