def test_respawn_player(self): gs = GameState(GameMap(5)) player = gs.add_player("1") gs.move_player(player, Action.FORWARD) self.assertNotEqual(player.position, player.spawn_position) player.killed = True gs.respawn_player(player) self.assertEqual(player.position, player.spawn_position) self.assertFalse(player.killed)
def test_move_player(self): gm = GameMap(5) player = PlayerState(id=1, name="1", game_map=gm, position=Position(1, 1)) player.direction = Direction(Direction.RIGHT) gs = GameState(gm, [player]) gs.move_player(player, Action.FORWARD) gs.move_player(player, Action.TURN_RIGHT) gs.move_player(player, Action.TURN_RIGHT) gs.move_player(player, Action.TURN_LEFT) self.assertEqual(Position(1, 3), player.position)