本文整理汇总了Python中enemy.Enemy.destroyed方法的典型用法代码示例。如果您正苦于以下问题:Python Enemy.destroyed方法的具体用法?Python Enemy.destroyed怎么用?Python Enemy.destroyed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类enemy.Enemy
的用法示例。
在下文中一共展示了Enemy.destroyed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testCleanup
# 需要导入模块: from enemy import Enemy [as 别名]
# 或者: from enemy.Enemy import destroyed [as 别名]
def testCleanup(self):
board = Board(5, 5)
player = Player()
enemy_one = Enemy()
enemy_one.destroyed = True
enemy_two = Enemy()
bullet_one = Bullet()
bullet_one.destroyed = True
bullet_two = Bullet()
bullet_two.destroyed = True
bullet_three = Bullet()
bonus_one = Bonus()
bonus_one.destroyed = True
bonus_two = Bonus()
board.rows[0][0] = player
board.rows[1][1] = enemy_one
board.rows[2][2] = enemy_two
board.rows[3][3] = bullet_one
board.rows[4][4] = bullet_two
board.rows[1][3] = bullet_three
board.rows[2][0] = bonus_one
board.rows[3][4] = bonus_two
board.cleanup()
self.assertEqual(board.rows[0][0], player)
self.assertEqual(board.rows[2][2], enemy_two)
self.assertEqual(board.rows[1][3], bullet_three)
self.assertEqual(board.rows[3][4], bonus_two)
self.assertIsNone(board.rows[1][1])
self.assertIsNone(board.rows[3][3])
self.assertIsNone(board.rows[4][4])
self.assertIsNone(board.rows[2][0])
示例2: testMoveOnDestroyedPiece
# 需要导入模块: from enemy import Enemy [as 别名]
# 或者: from enemy.Enemy import destroyed [as 别名]
def testMoveOnDestroyedPiece(self):
board = Board(5, 5)
player = Player()
enemy = Enemy()
enemy.destroyed = True
board.rows[1][1] = player
board.rows[2][2] = enemy
board.move_piece((1, 1), (2, 2))
self.assertEqual(board.rows[2][2], player)
self.assertIsNone(board.rows[1][1])
self.assertEqual(player.hits, MAX_HEALTH)