本文整理汇总了Python中Ship.upgrades[1]方法的典型用法代码示例。如果您正苦于以下问题:Python Ship.upgrades[1]方法的具体用法?Python Ship.upgrades[1]怎么用?Python Ship.upgrades[1]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ship
的用法示例。
在下文中一共展示了Ship.upgrades[1]方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: import Ship [as 别名]
# 或者: from Ship import upgrades[1] [as 别名]
#.........这里部分代码省略.........
allsprites.remove(sprite)
my_ship.hp -= sprite.damage
damage0.play()
if my_ship.hp < 0:
my_ship.die()
highscore(hs_table, score)
if sprite.y > 700:
allsprites.remove(sprite)
elif sprite.generictype == "PowerUp":
if sprite.y < -20 or sprite.y > 720 or sprite.x < -20 or sprite.x > 1020:
allsprites.remove(sprite)
del(sprite)
if pygame.Rect.colliderect(sprite.hitbox, my_ship.hitbox) == 1:
power0.play()
my_ship.xpowerup = sprite.name
my_ship.fire_delay = sprite.pow_speed
my_ship.coolantbonus = sprite.coolant
my_ship.powerleft = sprite.duration
my_ship.powermax = sprite.duration
allsprites.remove(sprite)
elif sprite.generictype == "Upgrade":
if sprite.y < -20 or sprite.y > 720 or sprite.x < -20 or sprite.x > 1020:
allsprites.remove(sprite)
del(sprite)
if pygame.Rect.colliderect(sprite.hitbox, my_ship.hitbox) == 1:
power0.play()
if sprite.spectype == "damage0":
my_ship.upgrades[0]=sprite.name
elif sprite.spectype == "backfire":
my_ship.upgrades[1]=sprite.name
allsprites.remove(sprite)
elif sprite.generictype == "Enemy":
if pygame.Rect.colliderect(sprite.hitbox, my_ship.hitbox) == 1:
my_ship.hp -= sprite.hp*5
sprite.hp -= my_ship.hp*5
if sprite.hp < 0:
explosion1.play()
allsprites.remove(sprite)
else:
damage0.play()
try:
crows.remove(sprite)
except:
pass
else:
pass
try:
swallows.remove(sprite)
except:
pass
else:
pass
del(sprite)
if my_ship.hp < 0:
#Game over
my_ship.hp = -1.3
my_ship.die()