Overflown/gamedata/objects/menu/mainmenu.py

33 lines
1.1 KiB
Python
Raw Normal View History

2021-06-25 14:42:35 +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
# Les dicos des boutons
2021-06-25 16:13:52 +02:00
def fnPlay(self,game):
game.scene = game.scenes.fight
btnPlay = {"name":"Jouer","function":fnPlay}
2021-06-25 14:42:35 +02:00
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 = [
2021-06-25 16:13:52 +02:00
[btnPlay],
2021-06-25 14:42:35 +02:00
[btnOptions],
[btnQuitter]
]
2021-06-25 16:13:52 +02:00
self.create(self.grid,self.rect)
2021-06-25 14:42:35 +02:00
2021-06-25 16:13:52 +02:00
def draw(self):
2021-06-25 14:42:35 +02:00
# affiche le titre du jeu
2021-06-25 16:13:52 +02:00
self.game.window.blit(self.game.sprite_lib["gui/title.png"],(0,self.baserect[1]-self.game.DISPLAY_HEIGHT/8))