miniopolis/lib/tiles.py

91 lines
2.3 KiB
Python
Raw Normal View History

2025-01-22 11:24:19 -05:00
"""
tiles.py
author: Caleb Scott
Contains all classes of tiles used in miniopolis
"""
# IMPORTS -----------------------------------------------------------
import arcade
2025-01-22 14:51:13 -05:00
from lib.game_config import *
2025-01-22 11:24:19 -05:00
# 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
2025-01-22 14:51:13 -05:00
self.properties["type"] = HOUSING
2025-01-22 11:24:19 -05:00
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
2025-01-22 14:51:13 -05:00
self.properties["type"] = LOGGER
2025-01-22 11:24:19 -05:00
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
2025-01-22 14:51:13 -05:00
self.properties["type"] = CROPS
2025-01-22 11:24:19 -05:00
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
2025-01-22 14:51:13 -05:00
self.properties["type"] = HYDROPOWER
2025-01-22 11:24:19 -05:00
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
2025-01-22 14:51:13 -05:00
self.properties["type"] = MINER
2025-01-22 11:24:19 -05:00
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
2025-01-22 14:51:13 -05:00
self.properties["type"] = FACTORY
2025-01-22 11:24:19 -05:00
self.center_x = x
self.center_y = y
2025-01-22 14:51:13 -05:00
class JunctionTile(arcade.Sprite):
def __init__(self, x, y):
self.image_file_name = JUNCTION_RES
super().__init__(self.image_file_name, TILE_SCALE)
# Set custom properties
self.properties["type"] = JUNCTION
self.center_x = x
self.center_y = y