From a5fee04bdca0fd42d84e509179e3edca185db977 Mon Sep 17 00:00:00 2001 From: Xevion Date: Mon, 20 Apr 2020 04:52:07 -0500 Subject: [PATCH] attempt to fix position text, minor docstring corrections --- triple-dungeon/main.py | 10 +++++----- triple-dungeon/map.py | 11 +++++++++-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/triple-dungeon/main.py b/triple-dungeon/main.py index dda90c7..48bc7af 100644 --- a/triple-dungeon/main.py +++ b/triple-dungeon/main.py @@ -40,7 +40,7 @@ class Game(arcade.Window): self.view_bottom = 0 self.view_left = 0 - arcade.set_background_color(arcade.csscolor.BLACK) + arcade.set_background_color(arcade.color.BLACK) def setup(self): """ Set up the game here. Call this function to restart the game. """ @@ -53,7 +53,7 @@ class Game(arcade.Window): self.player.scale = 1 # Create the dungeon - self.dungeon = Dungeon() + self.dungeon = Dungeon(0, 3) self.player.center_x, self.player.center_y = random.choice(self.dungeon.levelList).center() @@ -71,15 +71,15 @@ class Game(arcade.Window): # Clear the screen to the background color arcade.start_render() - x, y = self.player.center_x, self.player.center_y + 100 - arcade.draw_text(f"({x}, {y})", x, y, arcade.color.WHITE, 15) - # Draw our sprites self.dungeon.render() self.player.draw() self.enemy_list.draw() self.wall_list.draw() + x, y = self.player.center_x, self.player.center_y + 100 + arcade.draw_text(f"({x}, {y})", x, y, arcade.color.WHITE, 15) + def on_key_press(self, key, modifiers): """Called whenever a key is pressed. """ diff --git a/triple-dungeon/map.py b/triple-dungeon/map.py index 7adea54..105d0e8 100644 --- a/triple-dungeon/map.py +++ b/triple-dungeon/map.py @@ -43,7 +43,14 @@ class Dungeon(object): [Level.load_file(x, y, center) for y in range(size)] for x in range(size) ] - def getWalls(self): + def getWalls(self) -> arcade.SpriteList: + """ + Simple one time function for getting all Wall sprites from all Levels. + Used by the physics engine during game startup. + + :return: A SpriteList containing all Sprites. + """ + walls = arcade.SpriteList() walls.extend( list(chain.from_iterable( @@ -67,7 +74,7 @@ class Dungeon(object): @property def levelList(self) -> list: """ - Retrieves all Level objects from Dungeon intance. + Retrieves all Level objects from Dungeon instance. :return: A list containing all Level objects. """