Always use predefined map in game unit tests
This commit is contained in:
parent
209bde5b5c
commit
fb926f8c84
|
@ -54,6 +54,8 @@ class Map:
|
||||||
self.height = height
|
self.height = height
|
||||||
self.start_y = start_y
|
self.start_y = start_y
|
||||||
self.start_x = start_x
|
self.start_x = start_x
|
||||||
|
self.currenty = start_y
|
||||||
|
self.currentx = start_x
|
||||||
self.tiles = tiles
|
self.tiles = tiles
|
||||||
self.entities = []
|
self.entities = []
|
||||||
self.logs = Logs()
|
self.logs = Logs()
|
||||||
|
|
|
@ -12,7 +12,7 @@ from ..entities.items import Bomb, Heart, Sword
|
||||||
from ..entities.player import Player
|
from ..entities.player import Player
|
||||||
from ..enums import DisplayActions
|
from ..enums import DisplayActions
|
||||||
from ..game import Game, KeyValues, GameMode
|
from ..game import Game, KeyValues, GameMode
|
||||||
from ..interfaces import Tile
|
from ..interfaces import Tile, Map
|
||||||
from ..menus import MainMenuValues
|
from ..menus import MainMenuValues
|
||||||
from ..resources import ResourceManager
|
from ..resources import ResourceManager
|
||||||
from ..settings import Settings
|
from ..settings import Settings
|
||||||
|
@ -26,6 +26,10 @@ class TestGame(unittest.TestCase):
|
||||||
"""
|
"""
|
||||||
self.game = Game()
|
self.game = Game()
|
||||||
self.game.new_game()
|
self.game.new_game()
|
||||||
|
self.game.map = Map.load(ResourceManager.get_asset_path(
|
||||||
|
"example_map.txt"))
|
||||||
|
self.game.player.move(self.game.map.start_y, self.game.map.start_x)
|
||||||
|
self.game.map.add_entity(self.game.player)
|
||||||
self.game.logs.add_message("Hello World !")
|
self.game.logs.add_message("Hello World !")
|
||||||
display = DisplayManager(None, self.game)
|
display = DisplayManager(None, self.game)
|
||||||
self.game.display_actions = display.handle_display_action
|
self.game.display_actions = display.handle_display_action
|
||||||
|
|
Loading…
Reference in New Issue