本文整理汇总了Python中map.Map.updateLives方法的典型用法代码示例。如果您正苦于以下问题:Python Map.updateLives方法的具体用法?Python Map.updateLives怎么用?Python Map.updateLives使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类map.Map
的用法示例。
在下文中一共展示了Map.updateLives方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from map import Map [as 别名]
# 或者: from map.Map import updateLives [as 别名]
def main(arg):
f = file(arg,'r')
clock = pygame.time.Clock()
bullets = []
#init Map(grid, money, score, lives) depending on level
level = Map(f, 200, 0, 20)
level.popGrid(f)
level.drawMap()
exswitch = False
exswitch2 = False
startswitch = False
helpswitch = False
returnswitch = False
towerArray = []
minions = []
t_minions = 1
# run the game loop
while True:
gswitch = pygame.key.get_pressed()[K_g]
cswitch = pygame.key.get_pressed()[K_c]
pswitch = pygame.key.get_pressed()[K_p]
while level.bool is True and level.lives is not 0:
if(t_minions <= 10):
minions.append(Minions(level))
level.moveX(minions)
t_minions = t_minions + 1
else:
mousex, mousey = pygame.mouse.get_pos()
#print("MOUSE",mousex,mousey)
level.moveX(minions)
#level.live_out()
#level.score_out()
level.updateLevel()
level.updateLives()
level.updateScore()
level.updateMoney()
#level.money_out()
#level.blit_update()
if(not minions):
level.bool = False
level.level = level.level + 1
level.moveX([])
level.updateLevel()
level.updateLives()
level.updateScore()
level.updateMoney()
t_minions = 1
print("success")
for x in range(len(minions)):
print(minions[x].HP)
print('\n')
for x in minions:
for y in towerArray:
if(y.pingTower(x) is True):
level.bulletShoot(x,y)
if(y.damMini(x) is True):
level.score = level.score + x.score
level.updateScore()
#level.score_out()
level.money = level.money + x.value
#level.updateMoney()
try:
minions.remove(x)
except ValueError:
pass
print("LEVELmoney", level.money)
#break
break
level.blit_update()
if(level.lives is 0):
fonts = FontTemplate(('arial', 15))
rect = pygame.Rect(level.screenWidth/2,level.screenHeight/2,300,150)
pygame.draw.rect(level.windowSurface, constants.RED, rect)
fonts.Draw(level.windowSurface, 'arial', 12, 'YOU SUCK!! (Main Menu to return)', rect, constants.WHITE, 'center', 'center', True)
level.blit_update()
if(level.level is 10):
fonts = FontTemplate(('arial', 15))
rect = pygame.Rect(level.screenWidth/2,level.screenHeight/2,300,150)
pygame.draw.rect(level.windowSurface, constants.GREEN, rect)
fonts.Draw(level.windowSurface, 'arial', 12, 'CONGRATS,YOU STILL SUCK! :)', rect, constants.WHITE, 'center', 'center', True)
level.blit_update()
if(gswitch == 1):
level.drawGrid()
level.drawRange(towerArray)
if(cswitch == 1):
thing = True
level.drawMap()
for event in pygame.event.get():
if(exswitch is True and event.type is pygame.MOUSEBUTTONDOWN):
mousex, mousey = pygame.mouse.get_pos()
cord = level.getGridCord(mousex,mousey)
temporary = Tower(1)
#.........这里部分代码省略.........