From 69138c84663584b36df1b441b635d8cfded2a0e9 Mon Sep 17 00:00:00 2001 From: tsmith37 Date: Tue, 9 Dec 2025 20:02:49 -0500 Subject: [PATCH] add asteroids This project has sparked a interest in seeing what else i can creatate using coding --- .../__pycache__/shooter.cpython-313.pyc | Bin 1851 -> 1851 bytes .../__pycache__/targets.cpython-313.pyc | Bin 1616 -> 1616 bytes proposal.md/nav_game.py | 12 +++++++----- proposal.md/shooter.py | 3 --- proposal.md/targets.py | 18 ++++++++---------- 5 files changed, 15 insertions(+), 18 deletions(-) diff --git a/proposal.md/__pycache__/shooter.cpython-313.pyc b/proposal.md/__pycache__/shooter.cpython-313.pyc index f40f04a61772a1297cf1a0ad97f661accc76bbc3..aee127391fe72a7c9befdde1f659431cb674b263 100644 GIT binary patch delta 60 zcmdnZx0{dmGcPX}0}vP=vB-4T$ScUqcw@6Xa}5)t#O67yUW}~VtSVonCckEL=GA6Y M{lowyiui!a0oij7bpQYW delta 60 zcmdnZx0{dmGcPX}0}#|yn`gRjbAgBZGcPX}0}wE8wb;n5%*^}m|Ns9*Oh5rmrk6~Ut(ilaUNTOe#JrnPWV0Vj n6eFYhD>9s{%ccwfc0(94 delta 89 zcmcb>bAgBZGcPX}0}!ZIn{VV+X6F451Vv0h0ZpctjFYXILz#+%CQoAC%_zLtk0pwc lQEl={)+{MKpn@WP5Wxc^ZgJS;=BJeAq}ml3Ox9&n1^`;H7q0*S diff --git a/proposal.md/nav_game.py b/proposal.md/nav_game.py index 003698d..559368c 100644 --- a/proposal.md/nav_game.py +++ b/proposal.md/nav_game.py @@ -1,14 +1,16 @@ from retro.game import Game from spaceship import Spaceship -# from asteroid_spawner import AsteroidSpawner +from asteroid_spawner import AsteroidSpawner from targets import Alien from shooter import Shooter import random + board_size = (100, 25) width, height = board_size ship = Spaceship(board_size) -shooter = Shooter() -spawner = Alien((random.randint(0, width-1), random.randint(0, height-1))) -game = Game([ship, spawner, shooter], {"score": 0}, board_size=board_size, color="white_on_blue") -game.play() \ No newline at end of file +shooter = Shooter() +asteroid_spawner = AsteroidSpawner() +alien = Alien((random.randint(0, width - 1), random.randint(0, height - 1))) +game = Game([ship, shooter, asteroid_spawner, alien],{"score": 0},board_size=board_size,color="black_on_red") +game.play() diff --git a/proposal.md/shooter.py b/proposal.md/shooter.py index e633efb..376e947 100644 --- a/proposal.md/shooter.py +++ b/proposal.md/shooter.py @@ -9,7 +9,6 @@ class Shooter: self.position = (0, 0) def handle_keystroke(self, keystroke, game): - if keystroke == ' ' and not self.display: ship = game.get_agent_by_name('ship') if ship is None: @@ -23,9 +22,7 @@ class Shooter: self.display = True def play_turn(self, game): - if not self.display: - return x, y = self.position diff --git a/proposal.md/targets.py b/proposal.md/targets.py index 391ad96..757f07f 100644 --- a/proposal.md/targets.py +++ b/proposal.md/targets.py @@ -8,20 +8,18 @@ class Alien: self.position = position def play_turn(self, game): - width, height = game.board_size - x, y = self.position directions = [ - (-1, 0), # left - (1, 0), # right - (0, -1), # up - (0, 1), # down - (-1, -1), # up-left - (-1, 1), # down-left - (1, -1), # up-right - (1, 1) # down-right + (-2, 0), # left + (2, 0), # right + (0, -2), # up + (0, 2), # down + (-2, -2), # up-left + (-2, 2), # down-left + (2, -2), # up-right + (2, 2) # down-right ] possible_positions = []