所以在我的游戏菜单中,我正在创建一张显示如何玩游戏的图片,并且我有一些代码,以便当玩家按下 b 按钮时它返回到主菜单,但这不起作用, 有人能帮助我吗?
def manual():
image = games.load_image("options.jpg")
games.screen.background = image
if games.keyboard.is_pressed(games.K_b):
menu()
games.screen.mainloop()
'menu()' 是另一个函数,其中包含所有主菜单代码
这是菜单功能
def menu():
pygame.init()
menubg = games.load_image("menubg.jpg", transparent = False)
games.screen.background = menubg
# Just a few static variables
red = 255, 0, 0
green = 0,255, 0
blue = 0, 0,255
size = width, height = 640,480
screen = pygame.display.set_mode(size)
games.screen.background = menubg
pygame.display.update()
pygame.key.set_repeat(500,30)
choose = dm.dumbmenu(screen, [
'Start Game',
'Manual',
'Show Highscore',
'Quit Game'], 220,150,None,32,1.4,green,red)
if choose == 0:
main()
elif choose == 1:
manual()
elif choose == 2:
print("yay")
elif choose == 3:
print ("You choose Quit Game.")