generated from mwc/project_game
Game boarder and spaceship
Right now im trying to figure out why my target isnt showing up in the game how i will i get it to move how i want it
This commit is contained in:
19
proposal.md/targets.py
Normal file
19
proposal.md/targets.py
Normal file
@@ -0,0 +1,19 @@
|
||||
class Targets:
|
||||
character = '8'
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user