PinmikPanik/gamedata/objects/menu/mainmenu.py

33 lines
1.0 KiB
Python
Raw Normal View History

2021-09-10 19:22:30 +02:00
import gamedata.objects.menu.menu as menu
class MainMenu(menu.Menu):
def __init__(self,x,y,game,w=100,h=100):
super().__init__(x,y,game,w,h) # initialise l'objet de base avec les bons arguments
2021-09-10 21:33:24 +02:00
# Buttons dictionnaries
2021-09-10 19:22:30 +02:00
def fnPlay(self,game):
2021-09-10 21:33:24 +02:00
game.scene = game.scenes.ingame
2021-09-10 19:22:30 +02:00
btnPlay = {"name":"Play","function":fnPlay}
def fnOptions(self,game):
game.scene = game.scenes.options
btnOptions= {"name":"Options","function": fnOptions}
def fnQuit(self,game):
game.running = False
btnQuit= {"name":"Quit","function": fnQuit}
# Spacing between buttons
self.vpadding = 20
self.hpadding = 20
# Initialising grid
self.grid = [
[btnPlay],
[btnOptions],
[btnQuit]
]
self.create(self.grid,self.rect)
def draw(self):
# Display game title
self.game.window.blit(self.game.sprite_lib["gui/title.png"],(0,self.baserect[1]-self.game.DISPLAY_HEIGHT/8))