feat: item

- Create item.py
- Add update to remove expired items
- Add item settings for spawn interval, despawn timer, and size
This commit is contained in:
Berger Lena
2026-05-08 15:03:41 +02:00
parent 872786c8e3
commit 11ece2ee54
2 changed files with 30 additions and 9 deletions
+11 -9
View File
@@ -4,6 +4,7 @@ from typing import Mapping, Literal, Tuple
DESK_WIDTH = 70
DESK_HEIGHT = 40
# --- DOOR ---
DOOR_WIDTH = 20
DOOR_HEIGHT = 100
@@ -11,13 +12,13 @@ DOOR_BORDER_WIDTH = 3
COLOR_DOOR_BEIGE = (245, 245, 220)
COLOR_DOOR_BORDER = (100, 90, 80)
COLOR_HP_BAR_GREEN = (0, 255, 0)
COLOR_HP_BAR_BG = (50, 50, 50)
# Players Constants / Settings
# Valid movement/animation directions.
Direction = Literal["down", "left", "right", "up"]
# Sprite files are grouped by direction.
# Example: "down" uses sprite_01.png, sprite_02.png, sprite_03.png.
DIRECTION_FRAMES: Mapping[Direction, Tuple[int, int, int]] = {
@@ -27,14 +28,15 @@ DIRECTION_FRAMES: Mapping[Direction, Tuple[int, int, int]] = {
"up": (10, 11, 12),
}
# Default drawing size and animation speed.
DEFAULT_SPRITE_HEIGHT: int = 138
DEFAULT_FRAME_TIME: float = 0.16
=======
# --- ECTS ---
START_ECTS_VALUE = 1 # how many ECTS are generated at the beginning
ECTS_UPDATE_INTERVAL = 1000 # time in ms = 1 sec
ECTS_UPDATE_INTERVAL = 1000 # time in ms (1000 = 1 sec)
BEER_BOTTLE_ECTS_VALUE = 2
BEER_COST = 50
@@ -60,12 +62,12 @@ 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
# --- SHOPPING TIMER ---
ITEM_SHOPPING_TIMER = 10000 # for items like coffee, beer, tower - how long u have time to buy it
# -- ZOMBIE ---
# --- ZOMBIE ---
ZOMBIE_EASY_HP = 30
ZOMBIE_EASY_DMG = 3