本文整理汇总了Python中score.Score.set_length方法的典型用法代码示例。如果您正苦于以下问题:Python Score.set_length方法的具体用法?Python Score.set_length怎么用?Python Score.set_length使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类score.Score
的用法示例。
在下文中一共展示了Score.set_length方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from score import Score [as 别名]
# 或者: from score.Score import set_length [as 别名]
#.........这里部分代码省略.........
newpos = foods.make_apple(forbidden)
pavement.make_grass(newpos)
forbidden.extend(newpos)
if makegold:
self.sounds.play('ding')
newpos = foods.make_gold(forbidden)
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