generated from mwc/project_game
I was able to make the obstacles spawn on the screen more than just the top, now just need to work on moving my frog!
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -12,7 +12,7 @@ class Obstacle:
|
|||||||
game.remove_agent(self)
|
game.remove_agent(self)
|
||||||
else:
|
else:
|
||||||
froggy = game.get_agent_by_name('froggy')
|
froggy = game.get_agent_by_name('froggy')
|
||||||
new_position = (x, y + 1)
|
new_position = (x, y)
|
||||||
if new_position == froggy.position:
|
if new_position == froggy.position:
|
||||||
game.end()
|
game.end()
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class ObstacleSpawner:
|
|||||||
width, height = game.board_size
|
width, height = game.board_size
|
||||||
game.state['score'] += 1
|
game.state['score'] += 1
|
||||||
if self.should_spawn_obstacle(game.turn_number):
|
if self.should_spawn_obstacle(game.turn_number):
|
||||||
obstacle = Obstacle((randint(0, width - 1), 0))
|
obstacle = Obstacle((randint(0, width - 1), randint(0, width-1)))
|
||||||
game.add_agent(obstacle)
|
game.add_agent(obstacle)
|
||||||
|
|
||||||
def should_spawn_obstacle(self, turn_number):
|
def should_spawn_obstacle(self, turn_number):
|
||||||
|
|||||||
Reference in New Issue
Block a user