Merge branch 'master' into 'game'

# Conflicts:
#   dungeonbattle/game.py
#   dungeonbattle/mapdisplay.py
This commit is contained in:
ynerant
2020-11-06 18:36:59 +01:00
5 changed files with 55 additions and 31 deletions

View File

@ -1,6 +1,7 @@
import sys
from typing import Any
from .entities.player import Player
from .interfaces import Map
from .mapdisplay import MapDisplay
from .settings import Settings
@ -38,8 +39,8 @@ class Game:
# TODO generate a new map procedurally
self.m = Map.load("example_map.txt")
self.player = Player()
self.player.y = 1
self.player.x = 6
self.player.move(y, x)
self.m.add_entity(self.player)
self.d = MapDisplay(self.m, self.player)
@staticmethod
@ -94,21 +95,3 @@ class Game:
self.state = GameMode.SETTINGS
elif option == menus.MainMenuValues.EXIT:
sys.exit(0)
class Player:
# FIXME Should be elsewhere, only useful to don't break the previous code
y: int = 0
x: int = 0
def move_up(self) -> None:
self.y -= 1
def move_down(self) -> None:
self.y += 1
def move_left(self) -> None:
self.x -= 1
def move_right(self) -> None:
self.x += 1