Created
May 27, 2020 21:52
-
-
Save KramKroc/3b49522e6c62036c783ce06cfff6766a to your computer and use it in GitHub Desktop.
Adding sound and costume
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
WIDTH = 600 | |
HEIGHT = 400 | |
alien = Actor('alien', midbottom=(100,200)) | |
def draw(): | |
screen.fill((240, 6, 253)) | |
alien.draw() | |
def update(): | |
alien.left += 5 | |
if alien.left > WIDTH: | |
alien.topright = 0, random.randint(25, 375) | |
def on_mouse_down(pos): | |
if alien.collidepoint(pos): | |
print("you hit me!") | |
sounds.eep.play() | |
alien.image = "alien_hurt" | |
else: | |
print("you missed me!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment