Overflown/gamedata/objects/menu/mainmenu.py

33 lines
1.1 KiB
Python

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
# Les dicos des boutons
def fnPlay(self,game):
game.scene = game.scenes.fight
btnPlay = {"name":"Jouer","function":fnPlay}
def fnOptions(self,game):
game.scene = game.scenes.options
btnOptions= {"name":"Options","function": fnOptions}
def fnQuitter(self,game):
game.running = False
btnQuitter= {"name":"Quitter","function": fnQuitter}
# L'espacement
self.vpadding = 20
self.hpadding = 20
# Initialisation de la grille du menu
self.grid = [
[btnPlay],
[btnOptions],
[btnQuitter]
]
self.create(self.grid,self.rect)
def draw(self):
# affiche le titre du jeu
self.game.window.blit(self.game.sprite_lib["gui/title.png"],(0,self.baserect[1]-self.game.DISPLAY_HEIGHT/8))