add a alien target and a shooter to hit it

I am actually really proud that i was able to figure out how to make the alien move
in every direction randomly.
This commit is contained in:
tsmith37
2025-12-08 20:30:45 -05:00
parent d0c4bb8b26
commit 35ed9eb328
9 changed files with 130 additions and 16 deletions

19
proposal.md/asteroid.py Normal file
View File

@@ -0,0 +1,19 @@
class Asteroid:
character = 'O'
def __init__(self, position):
self.position = position
def play_turn(self, game):
width, height = game.board_size
if game.turn_number % 2 == 0:
x, y = self.position
if y == height - 1:
game.remove_agent(self)
else:
ship = game.get_agent_by_name('ship')
new_position = (x, y + 1)
if new_position == ship.position:
game.end()
else:
self.position = new_position