Finished cleaning conflicts
This commit is contained in:
parent
065f648118
commit
6e5cd9084b
@ -18,10 +18,10 @@ class Game:
|
||||
def new_game(self):
|
||||
# TODO generate a new map procedurally
|
||||
self.m = Map.load("example_map.txt")
|
||||
self.d = MapDisplay(self.m)
|
||||
self.player = Player()
|
||||
self.player.y = 1
|
||||
self.player.x = 6
|
||||
self.d = MapDisplay(self.m, self.player)
|
||||
|
||||
@classmethod
|
||||
def load_game(filename):
|
||||
@ -32,7 +32,7 @@ class Game:
|
||||
while True:
|
||||
screen.clear()
|
||||
screen.refresh()
|
||||
self.d.display(self.player.getPosY(), self.player.getPosX())
|
||||
self.d.display(self.player.y, self.player.x)
|
||||
key = screen.getkey()
|
||||
self.handle_key_pressed(key)
|
||||
|
||||
|
@ -5,23 +5,18 @@ from typing import Any
|
||||
from dungeonbattle.interfaces import Map
|
||||
|
||||
|
||||
<<<<<<< HEAD
|
||||
def __init__(self, m: Map):
|
||||
self.map = m
|
||||
self.pad = curses.newpad(m.height, m.width+1)
|
||||
=======
|
||||
class MapDisplay:
|
||||
def __init__(self, m: Map, player: Any):
|
||||
# TODO Type the player field with the good type
|
||||
self.map = m
|
||||
self.pad = curses.newpad(m.height, m.width + 1)
|
||||
self.player = player
|
||||
>>>>>>> master
|
||||
|
||||
def update_pad(self) -> None:
|
||||
self.pad.addstr(0, 0, self.map.draw_string())
|
||||
for e in self.map.entities:
|
||||
self.pad.addch(e.y, e.x, e.img)
|
||||
self.pad.addstr(self.player.y, self.player.x, '🐿️')
|
||||
|
||||
def display(self, y: int, x: int) -> None:
|
||||
deltay, deltax = (curses.LINES // 2) + 1, (curses.COLS // 2) + 1
|
||||
|
Loading…
Reference in New Issue
Block a user