diff --git a/.gitignore b/.gitignore index 5b88fa5..a433213 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,6 @@ dist/ downloads/ eggs/ .eggs/ -lib/ lib64/ parts/ sdist/ @@ -171,12 +170,5 @@ cython_debug/ .pypirc # Custom Omissions -maps/*.tiled-project -maps/*.tiled-session -maps/*.tsx -maps/*.tmx - -res/*.aseprite - template.py test-demo.py diff --git a/lib/__init__.py b/lib/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/lib/game_config.py b/lib/game_config.py new file mode 100644 index 0000000..7a4556d --- /dev/null +++ b/lib/game_config.py @@ -0,0 +1,44 @@ + +""" +game_config.py + +author: Caleb Scott + +Contains all constants needed to modify the game +""" + +# CONSTANTS --------------------------------------------------------- + +# Sizing +TILE_SCALE = 1.0 + +# Screen constants +SCREEN_WIDTH = 960 +SCREEN_HEIGHT = 960 +SCREEN_TITLE = "Miniopolis Demo" + +# World size +WORLD_WIDTH = 960 +WORLD_HEIGHT = 640 + +# Text placement +TEXT_X = 10 +TEXT_Y = SCREEN_HEIGHT - 30 +TEXT_Y_WIDTH = 30 + +# Resources/sprites +RES = "res/" +MINING_RES = RES + "miner.png" +HOUSING_RES = RES + "housing.png" +CROPS_RES = RES + "crops.png" +LOGGER_RES = RES + "logger.png" +HYDRO_RES = RES + "hydropower.png" +FACTORY_RES = RES + "factory.png" + +# Maps dir + map presets +MAPS = "maps/" +TEST_MAP = MAPS + "default-map.json" + +# Layers for Map +LAYER_STRUCTURES = "Structures" +LAYER_ENVIRONMENT = "Environment" diff --git a/lib/tiles.py b/lib/tiles.py new file mode 100644 index 0000000..5879ce8 --- /dev/null +++ b/lib/tiles.py @@ -0,0 +1,80 @@ +""" +tiles.py + +author: Caleb Scott + +Contains all classes of tiles used in miniopolis +""" + +# IMPORTS ----------------------------------------------------------- + +import arcade +from game_config import * + +# CLASSES ----------------------------------------------------------- + +class HousingTile(arcade.Sprite): + + def __init__(self, x, y): + self.image_file_name = HOUSING_RES + super().__init__(self.image_file_name, TILE_SCALE) + + # Set custom properties + self.properties["type"] = "HousingTile" + self.center_x = x + self.center_y = y + +class LoggerTile(arcade.Sprite): + + def __init__(self, x, y): + self.image_file_name = LOGGER_RES + super().__init__(self.image_file_name, TILE_SCALE) + + # Set custom properties + self.properties["type"] = "LoggerTile" + self.center_x = x + self.center_y = y + +class CropsTile(arcade.Sprite): + + def __init__(self, x, y): + self.image_file_name = CROPS_RES + super().__init__(self.image_file_name, TILE_SCALE) + + # Set custom properties + self.properties["type"] = "CropsTile" + self.center_x = x + self.center_y = y + +class HyroPowerTile(arcade.Sprite): + + def __init__(self, x, y): + self.image_file_name = HYDRO_RES + super().__init__(self.image_file_name, TILE_SCALE) + + # Set custom properties + self.properties["type"] = "HydroPowerTile" + self.center_x = x + self.center_y = y + +class MinerTile(arcade.Sprite): + + def __init__(self, x, y): + self.image_file_name = MINING_RES + super().__init__(self.image_file_name, TILE_SCALE) + + # Set custom properties + self.properties["type"] = "MinerTile" + self.center_x = x + self.center_y = y + +class FactoryTile(arcade.Sprite): + + def __init__(self, x, y): + self.image_file_name = FACTORY_RES + super().__init__(self.image_file_name, TILE_SCALE) + + # Set custom properties + self.properties["type"] = "FactoryTile" + self.center_x = x + self.center_y = y