本文整理汇总了Python中Menu.display_menu方法的典型用法代码示例。如果您正苦于以下问题:Python Menu.display_menu方法的具体用法?Python Menu.display_menu怎么用?Python Menu.display_menu使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Menu
的用法示例。
在下文中一共展示了Menu.display_menu方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: len
# 需要导入模块: import Menu [as 别名]
# 或者: from Menu import display_menu [as 别名]
texts = txt.split('\n')
lines = len(texts)
for i in xrange(lines):
draw_text(self.screen, texts[i], self.big_font, (SCR_SIZE[0]/2, 3*SCR_SIZE[1]/5 - 72*(lines - i)), (255,255,255), 1)
draw_text(self.screen, 'Press any key to continue', self.font, (SCR_SIZE[0]/2, 4*SCR_SIZE[1]/5), (255,255,255), 1)
while 1:
self.clock.tick(10)
for event in pygame.event.get():
if event.type == QUIT:
exit()
if event.type == KEYDOWN:
if self.keep_going: sounds['lava'].play(-1)
return
pygame.display.flip()
if __name__ == '__main__':
#pygame.init()
screen = pygame.display.set_mode(SCR_SIZE, (DOUBLEBUF|HWSURFACE) )
pygame.display.set_caption('Flee the Lava of Doom! -- By Jach')
pygame.mouse.set_visible(0)
menu = Menu(screen)
go = menu.display_menu()
while go:
game = Game(screen)
game.start()
go = menu.display_menu()
示例2: Game
# 需要导入模块: import Menu [as 别名]
# 或者: from Menu import display_menu [as 别名]
from Game import Game
from Santa import Santa
from Room import Room
from Obstacle import Obstacle
from Roamer import Roamer
from random import randint
import Menu
while True:
Menu.display_menu()
game = Game()
while True:
game.santa = Santa()
obstacles = []
roamer = Roamer(200, 150, 5, 72)
roamer.settarget()
game.room = Room(obstacles, [roamer])
game.santa.setpos(game.room.gen_positions(game.santa.width, game.santa.height))
for i in range(20):
validpos = True
while validpos:
posx = randint(96, 528)
posy = randint(0, 528)
for o in obstacles:
distsquared = ((posx - o.getx())**2) + ((posy - o.gety())**2)
if distsquared < 15000:
validpos = False
break
distsquared = ((posx - game.santa.getx())**2) + ((posy - game.santa.gety())**2)
if distsquared < 15000: