aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--__pycache__/cockroach_game.cpython-310.pycbin1584 -> 1581 bytes
-rw-r--r--astroid.py17
-rw-r--r--res/astroid.pngbin0 -> 91049 bytes
3 files changed, 17 insertions, 0 deletions
diff --git a/__pycache__/cockroach_game.cpython-310.pyc b/__pycache__/cockroach_game.cpython-310.pyc
index fdb6594..7bb4829 100644
--- a/__pycache__/cockroach_game.cpython-310.pyc
+++ b/__pycache__/cockroach_game.cpython-310.pyc
Binary files differ
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))
diff --git a/res/astroid.png b/res/astroid.png
new file mode 100644
index 0000000..4e72c92
--- /dev/null
+++ b/res/astroid.png
Binary files differ