From a22b472392104d55be070950d8e6ecce123ff4ea Mon Sep 17 00:00:00 2001 From: Xevion Date: Sat, 18 Apr 2020 01:25:36 -0500 Subject: [PATCH] create new config class for organizing constants --- triple-dungeon/config.py | 23 +++++++++++++++++++++++ triple-dungeon/main.py | 24 ------------------------ 2 files changed, 23 insertions(+), 24 deletions(-) create mode 100644 triple-dungeon/config.py diff --git a/triple-dungeon/config.py b/triple-dungeon/config.py new file mode 100644 index 0000000..052abe1 --- /dev/null +++ b/triple-dungeon/config.py @@ -0,0 +1,23 @@ +class Config(object): + """ + A simple class dedicated to loading, storing and organizing constants. + """ + + # Constants + SCREEN_WIDTH = 1000 + SCREEN_HEIGHT = 650 + SCREEN_TITLE = "Triple Dungeon" + + # Constants used to scale our sprites from their original size + CHARACTER_SCALING = 1 + TILE_SCALING = 2 + + # Movement speed of player, in pixels per frame + PLAYER_MOVEMENT_SPEED = 5 + + # How many pixels to keep as a minimum margin between the character + # and the edge of the screen. + LEFT_VIEWPORT_MARGIN = 250 + RIGHT_VIEWPORT_MARGIN = 250 + BOTTOM_VIEWPORT_MARGIN = 50 + TOP_VIEWPORT_MARGIN = 100 diff --git a/triple-dungeon/main.py b/triple-dungeon/main.py index f85d015..3ded8ac 100644 --- a/triple-dungeon/main.py +++ b/triple-dungeon/main.py @@ -1,29 +1,5 @@ -""" -Platformer Game -""" import arcade -# Constants -SCREEN_WIDTH = 1000 -SCREEN_HEIGHT = 650 -SCREEN_TITLE = "Triple Dungeon!!!" - -# Constants used to scale our sprites from their original size -CHARACTER_SCALING = 1 -TILE_SCALING = 2 - -# Movement speed of player, in pixels per frame -PLAYER_MOVEMENT_SPEED = 5 - - -# How many pixels to keep as a minimum margin between the character -# and the edge of the screen. -LEFT_VIEWPORT_MARGIN = 250 -RIGHT_VIEWPORT_MARGIN = 250 -BOTTOM_VIEWPORT_MARGIN = 50 -TOP_VIEWPORT_MARGIN = 100 - - class MyGame(arcade.Window): """ Main application class.