refactor: create ItemManger class

- add itemManager class and moved randomPosition and update into it
- add is_expired to check if time ran out to buy spawned item
This commit is contained in:
Berger Lena
2026-05-08 15:47:29 +02:00
parent 3ca2ef1332
commit 2a6c93998b
2 changed files with 49 additions and 42 deletions
+5
View File
@@ -41,10 +41,12 @@ ECTS_UPDATE_INTERVAL = 1000 # time in ms (1000 = 1 sec)
BEER_BOTTLE_ECTS_VALUE = 2
BEER_COST = 50
# --- BUTTONS ---
COLOR_BUTTON = (0, 255, 0)
COLOR_BUTTON_HOVER = (200, 255, 0)
# --- STARTSCREEN ---
COLOR_STARTSCREEN_BACKGROUND = ((0, 0, 0))
COLOR_STARTSCREEN_FONT_TITLE = (0, 255, 0)
@@ -55,6 +57,7 @@ COLOR_STARTSCREEN_FONT_LABEL = (0, 255, 255)
COFFEE_COST = 30
COFFEE_HEAL_VALUE = 30
# --- TOWER ---
TOWER_COST = 150
PROJECTILE_DMG = 15
@@ -62,11 +65,13 @@ PROJECTILE_SPEED = 7
COLOR_PROJECTILE = (200, 200, 0)
TOWER_TIMER = 30000 # how long the tower stays and attack before it disappears
# --- ITEM SPAWN TIMER ---
ITEM_SPAWN_INTERVAL = 5000 # ms until a new item spawns
ITEM_SHOPPING_TIMER = 10000 # how long you have time to buy items before they despawn
ITEM_SIZE = 30
# --- ZOMBIE ---
ZOMBIE_EASY_HP = 30
ZOMBIE_EASY_DMG = 3