diff options
Diffstat (limited to 'cockroach_game.py')
-rw-r--r-- | cockroach_game.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/cockroach_game.py b/cockroach_game.py index 23e8265..2959654 100644 --- a/cockroach_game.py +++ b/cockroach_game.py @@ -11,14 +11,16 @@ SCREEN_HEIGHT = 600 # Load cockroach image cockroach_image = pygame.image.load('res/cockroach.png') +cockroach_image = pygame.image.load('res/cockroach.png') + class Cockroach: def __init__(self): - self.x = SCREEN_WIDTH - self.y = random.randint(0, SCREEN_HEIGHT - 40) - self.speed_x = random.randint(1, 5) + 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 - def move(self): - self.x -= self.speed_x + def move_down(self): + self.y += self.speed_y def draw(self, screen): screen.blit(cockroach_image, (self.x, self.y)) |