本文整理汇总了Python中Ship.loseLife方法的典型用法代码示例。如果您正苦于以下问题:Python Ship.loseLife方法的具体用法?Python Ship.loseLife怎么用?Python Ship.loseLife使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ship
的用法示例。
在下文中一共展示了Ship.loseLife方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Controller
# 需要导入模块: import Ship [as 别名]
# 或者: from Ship import loseLife [as 别名]
#.........这里部分代码省略.........
if event.type == USEREVENT+1:
bulletList = self.bulletGroup.sprites()
self.bulletGroup.update()
enemyList = self.enemyGroup.sprites()
bossList = self.bossGroup.sprites()
for x in range(len(bulletList)):
if bulletList[x].team == 0:
for boss in bossList:
if pygame.sprite.collide_circle(bulletList[x], boss):
bulletList[x].kill()
if boss.loseHealth(1):
sc += 500*multiplier
boss.kill()
pygame.time.set_timer(pygame.USEREVENT+6, self.diff)
pygame.time.set_timer(pygame.USEREVENT, 60000)
for i in range(len(enemyList)):
if bulletList[x].team == 0 and pygame.sprite.collide_circle(bulletList[x], enemyList[i]):
enemyDeath.play()
sc += 50*multiplier
multiplier += 1
enemyList[i].kill()
bulletList[x].kill()
if bulletList[x].team == 1 and pygame.sprite.collide_circle(self.ship, bulletList[x]):
bulletList[x].kill()
if not self.ship.invincible:
if self.ship.lives == 1:
shipDeath.play()
else:
shipShieldDeath.play()
self.ship.loseLife()
heartNumber -= 1
multiplier = 1
self.ship.giveShield(2, 1)
if self.ship.lives <= 0:
pygame.time.set_timer(pygame.USEREVENT+1, 0) #Timer for bullet
pygame.time.set_timer(pygame.USEREVENT+2, 0) #Timer for background
pygame.time.set_timer(pygame.USEREVENT+3, 0) #Timer for shooting
pygame.time.set_timer(pygame.USEREVENT+4, 0) #Timer for moving
pygame.time.set_timer(pygame.USEREVENT+5, 0) #Timer for Enemy Shooting
pygame.time.set_timer(pygame.USEREVENT+6, 0) #Timer for enemy spawn
pygame.time.set_timer(pygame.USEREVENT+7, 0) #Timer for Power Up spawn
pygame.time.set_timer(pygame.USEREVENT, 0) #Timer for boss spawn
txtbx = eztext.Input(maxlength=25, color=(0,0,0), prompt='Enter name: ')
while True:
events = pygame.event.get()
# process other events
for event in events:
# close if x button is pressed
if event.type == QUIT:
return "Exit"
# clear the screen
self.screen.fill((255,255,255))
# update txtbx
s = txtbx.update(events)
if s != None:
string = str(sc) + "\t" + s + "\n"
if self.diff == 1000:
inputPath = "outputs\\Easy.txt"
outputPath = "outputs\\Easy_New.txt"
File = open(inputPath, 'r')