Four gameplay parameters are now driven by the selected difficulty, following the existing 'hard = harder for the player' philosophy: param easy normal hard gas_spread_speed 40 50 90 (higher = slower gas) weapon_refill_multiplier 1.3 1.0 0.6 (less ammo on hard) max_babies 2 3 5 (more pups on hard) mate_stop_male / female 120/240 100/200 60/120 (shorter stop on hard) Implementation: - engine/config.py: new keys on each DIFFICULTY_OPTIONS entry. - rats.py: _apply_difficulty() loads them onto the game (with __init__ defaults for safety); normal keeps the previous hardcoded values. - units/gas.py: Gas.speed reads game.gas_spread_speed (fallback 50). - engine/unit_manager.py: refill_ammo() scales per-frame refill chances by game.weapon_refill_multiplier (fallback 1.0). - units/rat.py: Male.fuck() uses game.mate_stop_male/mate_stop_female and random.randint(1, game.max_babies) (fallbacks to old values). All reads use getattr with the previous constant as fallback, so older configs / saved state keep working.
93 lines
2.6 KiB
Python
93 lines
2.6 KiB
Python
# Game constants and configuration
|
|
|
|
LEVEL_MUSIC_CONFIG = "level_music"
|
|
START_MENU_MUSIC = "High_Score_Garden.mp3"
|
|
RUN_COMPLETE_MUSIC = "Sunset_At_Pixel_Gardens.mp3"
|
|
START_MENU_ANIMATION = "anim/start_mice.gif"
|
|
SUPPORTED_MUSIC_EXTENSIONS = {".mp3", ".ogg", ".wav"}
|
|
BASE_INITIAL_RATS = 5
|
|
DEFAULT_DIFFICULTY = "easy"
|
|
DIFFICULTY_ALIASES = {
|
|
"medium": "normal",
|
|
"normale": "normal",
|
|
}
|
|
START_MENU_AUDIO_OPTIONS = (
|
|
("sound_volume", "Suono"),
|
|
("music_volume", "Musica"),
|
|
)
|
|
VOLUME_STEP = 5
|
|
|
|
GAME_END_LEVEL_CLEAR = "level_clear"
|
|
GAME_END_DEFEAT = "defeat"
|
|
GAME_END_RUN_COMPLETE = "run_complete"
|
|
|
|
DIFFICULTY_OPTIONS = (
|
|
{
|
|
"key": "easy",
|
|
"label": "Easy",
|
|
"starting_rats_multiplier": 1,
|
|
"speed_multiplier": 1.0,
|
|
# Gas spread tick interval (higher = slower spread = less effective weapon).
|
|
"gas_spread_speed": 40,
|
|
# Multiplier applied to per-frame weapon refill probabilities.
|
|
"weapon_refill_multiplier": 1.3,
|
|
# Upper bound for babies per litter (random.randint(1, max_babies)).
|
|
"max_babies": 2,
|
|
# Stop ticks after mating for the male / the pregnant female.
|
|
"mate_stop_male": 120,
|
|
"mate_stop_female": 240,
|
|
"fill": (235, 246, 234),
|
|
"accent": (88, 148, 82),
|
|
},
|
|
{
|
|
"key": "normal",
|
|
"label": "Normal",
|
|
"starting_rats_multiplier": 2,
|
|
"speed_multiplier": 1.5,
|
|
"gas_spread_speed": 50,
|
|
"weapon_refill_multiplier": 1.0,
|
|
"max_babies": 3,
|
|
"mate_stop_male": 100,
|
|
"mate_stop_female": 200,
|
|
"fill": (252, 242, 223),
|
|
"accent": (204, 146, 44),
|
|
},
|
|
{
|
|
"key": "hard",
|
|
"label": "Hard",
|
|
"starting_rats_multiplier": 3,
|
|
"speed_multiplier": 2.0,
|
|
"gas_spread_speed": 90,
|
|
"weapon_refill_multiplier": 0.6,
|
|
"max_babies": 5,
|
|
"mate_stop_male": 60,
|
|
"mate_stop_female": 120,
|
|
"fill": (251, 229, 229),
|
|
"accent": (188, 68, 68),
|
|
},
|
|
)
|
|
|
|
DIFFICULTY_OPTIONS_BY_KEY = {option["key"]: option for option in DIFFICULTY_OPTIONS}
|
|
|
|
START_MENU_COLORS = {
|
|
"panel_fill": (255, 255, 255),
|
|
"panel_border": (52, 52, 52),
|
|
"header_fill": (255, 255, 255),
|
|
"text": (24, 24, 24),
|
|
"muted": (82, 82, 82),
|
|
"hint_fill": (255, 255, 255),
|
|
"track_fill": (212, 215, 216),
|
|
"card_fill": (255, 255, 255),
|
|
}
|
|
|
|
START_MENU_AUDIO_STYLES = {
|
|
"sound_volume": {
|
|
"accent": (214, 146, 62),
|
|
"fill": (251, 241, 225),
|
|
},
|
|
"music_volume": {
|
|
"accent": (91, 122, 208),
|
|
"fill": (230, 235, 248),
|
|
},
|
|
}
|