attempt to fix position text, minor docstring corrections

This commit is contained in:
Xevion
2020-04-20 04:52:07 -05:00
parent 6f1161ab75
commit a5fee04bdc
2 changed files with 14 additions and 7 deletions

View File

@@ -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. """

View File

@@ -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.
"""