diff options
Diffstat (limited to 'cockroach.py')
-rw-r--r-- | cockroach.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/cockroach.py b/cockroach.py new file mode 100644 index 0000000..67b7df1 --- /dev/null +++ b/cockroach.py @@ -0,0 +1,18 @@ +import pygame +import random + + +class Cockroach: + def __init__(self): + self.x = random.randint(80, 800) # Random x position within the screen width + self.y = 60 # Starting y position at the top + self.speed_y = random.randint(1, 5) # Random downward speed + + # Load cockroach image + self.cockroach_image = pygame.image.load('res/cockroach.png') + + def move_down(self): + self.y += self.speed_y + + def draw(self, screen): + screen.blit(self.cockroach_image, (self.x, self.y)) |