aboutsummaryrefslogtreecommitdiff
path: root/astroid.py
diff options
context:
space:
mode:
authorDestinyyyyyyy <abhiramvsa7@gmail.com>2023-07-30 14:07:34 +0530
committerDestinyyyyyyy <abhiramvsa7@gmail.com>2023-07-30 14:07:34 +0530
commit1f583f13f2253af91daf1f44d533c50b05996170 (patch)
treea1d3064d590df8a32f3200cc662921948c4d36b5 /astroid.py
parent1921f03e8ba573018c95b78116c057cafae6b1c7 (diff)
commit
Diffstat (limited to 'astroid.py')
-rw-r--r--astroid.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/astroid.py b/astroid.py
new file mode 100644
index 0000000..6a7187d
--- /dev/null
+++ b/astroid.py
@@ -0,0 +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
+
+ def move_down(self):
+ self.y += self.speed_y
+
+ def draw(self, screen):
+ screen.blit(asteroid_image, (self.x, self.y))