def test_assets_bit_map(): bit_map = assets.generate_map() for y in range(len(bit_map)): for x in range(len(bit_map[y])): if y == 0 or y == bit_map.shape[ 0] - 1 or x == 0 or x == bit_map.shape[1]: assert bit_map[y][x] == 1
def test_map_SuperFoodBlock(): map = src.map.Map(assets.generate_map()) block = src.map.SuperFoodBlock(assets.WALL, map, 10) assert not block.collected assert map.score == 0 block.collect() assert block.collected assert map.score == 100
def test_map_scatter(): test_map = src.map.Map(assets.generate_map()) ghost1 = test_map.ghosts[0] test_map.set_scatter(True) assert ghost1.targetBehaviour.scatterBehaviour test_map.set_scatter(False) assert not ghost1.targetBehaviour.scatterBehaviour test_map.set_scatter(True) assert ghost1.targetBehaviour.scatterBehaviour
def __init__(self): bit_map = assets.generate_map() super().__init__(bit_map.shape[1] * settings.BLOCK_SIZE, bit_map.shape[0] * settings.BLOCK_SIZE + settings.BLOCK_SIZE * 3, "PAC-MAN", resizable=False) self.map = Map(bit_map) self.event_loop = pyglet.app.EventLoop() pyglet.clock.schedule_interval(self.update, 1 / 120.0)
def test_map_release(): test_map = src.map.Map(assets.generate_map()) ghost1 = test_map.ghosts[0] assert ghost1.locked test_map.release(ghost1) assert not ghost1.locked