本文整理汇总了Python中enemy.Enemy.moveVertically方法的典型用法代码示例。如果您正苦于以下问题:Python Enemy.moveVertically方法的具体用法?Python Enemy.moveVertically怎么用?Python Enemy.moveVertically使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类enemy.Enemy
的用法示例。
在下文中一共展示了Enemy.moveVertically方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: len
# 需要导入模块: from enemy import Enemy [as 别名]
# 或者: from enemy.Enemy import moveVertically [as 别名]
shotCooldown -= dt
allShots=pygame.sprite.Group(shots)
for shot in shots:
if shot.update():
shots.remove(shot)
if pygame.sprite.spritecollide(shot,allEnemies,True):
shots.remove(shot)
shot.playExplosion()
for enemy in enemies:
if enemy.getCoordinates()[0] > screen.get_width() - 50:
movement = -1
elif enemy.getCoordinates()[0] < 50:
movement = 1
else:
movement = movement
enemy.moveVertically(movement)
allEnemies.clear(screen,background)
allShots.clear(screen,background)
playerSprite.clear(screen,background)
allEnemies.update()
playerSprite.update()
allEnemies.draw(screen)
allShots.draw(screen)
playerSprite.draw(screen)
pygame.display.update()
if endcooldown > 0:
endcooldown -= dt
if not len(allEnemies):
if(endcooldown == False):
endcooldown = 1000