aboutsummaryrefslogtreecommitdiff
path: root/asteroid.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--asteroid.py (renamed from astroid.py)8
1 files changed, 4 insertions, 4 deletions
diff --git a/astroid.py b/asteroid.py
index 6a7187d..1735c8b 100644
--- a/astroid.py
+++ b/asteroid.py
@@ -1,17 +1,17 @@
import pygame
import random
-# Load asteroid image
-asteroid_image = pygame.image.load('res/asteroid.png')
-
class Asteroid:
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, 3) # Random downward speed
+ # Load asteroid image
+ self.asteroid_image = pygame.image.load('res/asteroid.png')
+
def move_down(self):
self.y += self.speed_y
def draw(self, screen):
- screen.blit(asteroid_image, (self.x, self.y))
+ screen.blit(self.asteroid_image, (self.x, self.y))