def showStartScreen(titlescreen):
which = 0
directions = {pygame.locals.K_s: 1, pygame.locals.K_DOWN: 1,
pygame.locals.K_w: -1, pygame.locals.K_UP: -1}
whichgamemode = {0: runsingleplayer, 1: runmultibattle, 2: runcoop}
titlescreen.drawStartScreen(which)
pygame.display.update()
running = True
while running: # menu key handler
for event in pygame.event.get(): # event handling loop
if event.type == pygame.locals.QUIT or (
event.type == pygame.locals.KEYDOWN and
event.key == pygame.locals.K_ESCAPE):
terminate()
elif event.type == pygame.locals.KEYDOWN and \
event.key in directions:
which = (which + directions[event.key]) % 3
titlescreen.drawPressChooseModeScreen(which)
pygame.display.update()
elif event.type == pygame.locals.KEYDOWN and \
event.key == pygame.locals.K_RETURN:
global runGame
runGame = whichgamemode[which]
running = False
break
评论列表
文章目录