diff --git a/triple-dungeon/config.py b/triple-dungeon/config.py index 9ed6819..5a92183 100644 --- a/triple-dungeon/config.py +++ b/triple-dungeon/config.py @@ -3,8 +3,11 @@ config.py Holds all constants used for setting up the game. May later hold functions for loading/saving configuration files. """ + import os +from enum import Enum + BASE_PATH = os.path.dirname(os.path.abspath(__file__)) RESOURCES = os.path.join(BASE_PATH, "resources") IMAGES = os.path.join(RESOURCES, "images") @@ -37,6 +40,18 @@ class Config(object): TOP_VIEWPORT_MARGIN = 100 +class Enums(Enum): + """ + A simple class used for tracking different simple + """ + + # Play Direction Enums + RIGHT_FACING + LEFT_FACING + FRONT_FACING + UP_FACING + DOWN_FACING + class Sprites(object): """ Simple class for holding sprite paths. diff --git a/triple-dungeon/mobs.py b/triple-dungeon/mobs.py index b2e34ea..283958e 100644 --- a/triple-dungeon/mobs.py +++ b/triple-dungeon/mobs.py @@ -5,15 +5,7 @@ Organizes all classes related to Mobs, Entities, Enemies, Players and Items. import arcade -from config import Config - -# Constants used to track if the player is facing left or right -RIGHT_FACING = 0 -LEFT_FACING = 1 -FRONT_FACING = 2 -UP_FACING = 3 -DOWN_FACING = 4 - +from config import Config, Enums class Mob(arcade.Sprite): """ @@ -51,7 +43,7 @@ class Player(Mob): main_path = "resources/images/character/knight/" # Default to face-front - self.character_face_direction = FRONT_FACING + self.character_face_direction = Enums.FRONT_FACING # Load textures for idle standing for i in range(4): @@ -80,11 +72,11 @@ class Player(Mob): # Figure out if we need to flip face left, right, up, or down if self.change_x > 0: - self.character_face_direction = LEFT_FACING + self.character_face_direction = Enums.LEFT_FACING elif self.change_x < 0: - self.character_face_direction = RIGHT_FACING + self.character_face_direction = Enums.RIGHT_FACING elif self.change_x == 0 and self.change_y == 0: - self.character_face_direction = FRONT_FACING + self.character_face_direction = Enums.FRONT_FACING # idle animation if self.change_x == 0 and self.change_y == 0: