Linting
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
from typing import Any
|
||||
|
||||
from .interfaces import Map
|
||||
from .mapdisplay import MapDisplay
|
||||
from .settings import Settings
|
||||
@ -15,7 +17,7 @@ class Game:
|
||||
with TermManager() as term_manager:
|
||||
self._start_game(term_manager.screen)
|
||||
|
||||
def _start_game(self, screen):
|
||||
def _start_game(self, screen: Any) -> None:
|
||||
# TODO Generate map, or make the possibility to load another one
|
||||
m = Map.load("example_map.txt")
|
||||
player = Player()
|
||||
@ -26,11 +28,11 @@ class Game:
|
||||
while True:
|
||||
screen.clear()
|
||||
screen.refresh()
|
||||
d.display(player.getPosY(), player.getPosX())
|
||||
d.display(player.y, player.y)
|
||||
key = screen.getkey()
|
||||
self.handle_key_pressed(key)
|
||||
|
||||
def handle_key_pressed(self, key):
|
||||
def handle_key_pressed(self, key: str) -> None:
|
||||
# TODO load keys from settings
|
||||
if key == 'z' or key == 'KEY_UP':
|
||||
self.player.move_up()
|
||||
@ -47,20 +49,14 @@ class Player:
|
||||
y: int = 0
|
||||
x: int = 0
|
||||
|
||||
def move_up(self):
|
||||
def move_up(self) -> None:
|
||||
self.y -= 1
|
||||
|
||||
def move_down(self):
|
||||
def move_down(self) -> None:
|
||||
self.y += 1
|
||||
|
||||
def move_left(self):
|
||||
def move_left(self) -> None:
|
||||
self.x -= 1
|
||||
|
||||
def move_right(self):
|
||||
def move_right(self) -> None:
|
||||
self.x += 1
|
||||
|
||||
def getPosX(self):
|
||||
return self.x
|
||||
|
||||
def getPosY(self):
|
||||
return self.y
|
||||
|
Reference in New Issue
Block a user