Start game button is working

This commit is contained in:
Yohann D'ANELLO
2020-11-08 23:08:38 +01:00
parent 715fad1817
commit 7e92086601
2 changed files with 8 additions and 36 deletions

View File

@ -1,8 +1,9 @@
import sys
from typing import Any
from .display.display import Display
from .display.mapdisplay import MapDisplay
from .display.menudisplay import MenuDisplay
from .display.texturepack import TexturePack
from .entities.player import Player
from .interfaces import Map
from .settings import Settings
@ -39,7 +40,11 @@ class Game:
self.player = Player()
self.player.move(1, 6)
self.m.add_entity(self.player)
self.current_display = MenuDisplay(self, self.main_menu, 0, 0)
self.menu_display = MenuDisplay(screen, self.main_menu, 0, 0)
self.map_display = MapDisplay(
screen, self.m, self.player,
TexturePack.get_pack(self.settings.TEXTURE_PACK))
self.current_display = self.menu_display
@staticmethod
def load_game(filename: str) -> None:
@ -90,6 +95,7 @@ class Game:
option = self.main_menu.validate()
if option == menus.MainMenuValues.START:
self.state = GameMode.PLAY
self.current_display = self.map_display
elif option == menus.MainMenuValues.SETTINGS:
self.state = GameMode.SETTINGS
elif option == menus.MainMenuValues.EXIT: