当前位置: 首页>>代码示例>>Python>>正文


Python Enemy.destroyed方法代码示例

本文整理汇总了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])
开发者ID:elenaod,项目名称:PythonScrollingShooter,代码行数:33,代码来源:test_board.py

示例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)
开发者ID:elenaod,项目名称:PythonScrollingShooter,代码行数:13,代码来源:test_board.py


注:本文中的enemy.Enemy.destroyed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。