本文整理汇总了Python中score.Score.add_second方法的典型用法代码示例。如果您正苦于以下问题:Python Score.add_second方法的具体用法?Python Score.add_second怎么用?Python Score.add_second使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类score.Score
的用法示例。
在下文中一共展示了Score.add_second方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from score import Score [as 别名]
# 或者: from score.Score import add_second [as 别名]
#.........这里部分代码省略.........
pavement.make_grass(newpos)
forbidden.extend(newpos)
makegold = False
if makewall:
self.sounds.play('fall')
newpos = walls.make_solid(forbidden)
pavement.make_none(newpos)
forbidden.extend(newpos)
makewall = False
# Foods request pavement update
for pos in foods.refresh:
pavement.passage(pos)
foods.refresh.remove(pos)
del pos
# Updates and draws
pavement.update()
pavement.draw(self.surface)
walls.update()
walls.draw(self.surface)
snake.update()
snake.draw(self.surface)
foods.update()
foods.draw(self.surface)
if updatestats or not counter % Constants.FPS:
score.set_length(snake.length)
score.update()
score.draw(self.screen)
updatestats = False
if not counter % Constants.FPS:
score.add_second()
counter = 0
# Surface on surface... weeee!
self.screen.blit(self.surface,self.surface_rect)
pygame.display.update()
self.clock.tick(self.tick)
counter+=1
#END OF MAIN LOOP
if not snake.alive:
self.print_text("GAME OVER")
if highscores.check(score.score,score.elapse):
current_string = ''
complete = False
inputbox = InputBox(self.unit)
inputbox.rect.centerx = self.screen.get_rect().centerx
inputbox.rect.centery = self.screen.get_rect().centery
inputbox.draw(self.screen)
pygame.display.update()
pygame.event.clear()
redraw = False
while not complete:
event = pygame.event.wait()
if event.type == pygame.QUIT:
return
if event.type != pygame.KEYDOWN:
continue