From a91f781f76b7dba9f7d241f47b34bbf4635a3029 Mon Sep 17 00:00:00 2001 From: angelotr Date: Tue, 9 Dec 2025 00:42:44 -0500 Subject: [PATCH] For my final entry, I tried to incorporate the ability to shoot bullet from the spaceshit to destory the asteroids. I attempted to add a shooting feature where the player presses the M key to fire bullets upward. Originally, I tried making the space bar the key to shoot but this has shown to be difficult as it did not shoot bullets using M or the space bar. I created a new Bullet class and added code to spaceship.py that should create a bullet agent above the ship.However, the shooting did not work because Retro was not detecting the M key the way the code expected. Even though the feature is not working yet, it is an important mechanic because it would allow the player to clear asteroids and add a new layer of interaction and strategy to the game. I was annoyed with the idea that I was not able to get shooting to work but ultimately I decided to keep it within my code as a way to show that my previous did work and eventhough the shooting mechanic did not it is important for me to look back at it one day. Even if it doesn't work, it was an attempt at an idea. --- bullet.py | 2 +- spaceship.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bullet.py b/bullet.py index 484c713..09706bb 100644 --- a/bullet.py +++ b/bullet.py @@ -29,4 +29,4 @@ class Bullet: # Reward points for hitting an asteroid game.state["score"] += 10 return - #here \ No newline at end of file + \ No newline at end of file diff --git a/spaceship.py b/spaceship.py index 3b34c83..ef056fd 100644 --- a/spaceship.py +++ b/spaceship.py @@ -49,7 +49,7 @@ class Spaceship: if game.is_empty(new_position): self.position = new_position else: - # We bumped into something (probably an asteroid) + # We bumped into something self.take_damage(game) def take_damage(self, game):