wobblyhead hg > minor_monsters
comparison tools/build.py @ 24:3f2811aebb3d 0.9.0
splash screen buttons, help button, info screen
| author | ark |
|---|---|
| date | 2026-10-20 15:58 +0200 |
| parents | 2f555a54c332 |
| children | 75deda08db90 |
comparison
equal
deleted
inserted
replaced
| 23:2f555a54c332 | 24:3f2811aebb3d |
|---|---|
| 57 + ["coin_icon", "heart", "monster_icon", "play_button", "pause_button", | 57 + ["coin_icon", "heart", "monster_icon", "play_button", "pause_button", |
| 58 "speed_x1", "speed_x2", "speed_x4", "sound_on", "sound_off", "next_wave", | 58 "speed_x1", "speed_x2", "speed_x4", "sound_on", "sound_off", "next_wave", |
| 59 "shop_bubble", "shop_bubble_dark", "shop_bubble_dark2", "tower_popup", | 59 "shop_bubble", "shop_bubble_dark", "shop_bubble_dark2", "tower_popup", |
| 60 "upgrade_button", "sell_button", "monster_death", "boss_death", | 60 "upgrade_button", "sell_button", "monster_death", "boss_death", |
| 61 "splash", "splash_play", "map_won", "map_won_button", | 61 "splash", "splash_play", "map_won", "map_won_button", |
| 62 "game_lost", "game_lost_button", "game_won", "game_won_button"]) | 62 "game_lost", "game_lost_button", "game_won", "game_won_button", |
| 63 "wobbly_logo", "help_splash", "help_button", "help_info", "freeze"]) | |
| 63 # hp bar variants (art.md): the empty part is a darkened copy, the bar of a | 64 # hp bar variants (art.md): the empty part is a darkened copy, the bar of a |
| 64 # slowed monster has its colour set to this hue in degrees | 65 # slowed monster has its colour set to this hue in degrees |
| 65 BAR_DARKEN = 0.35 | 66 BAR_DARKEN = 0.35 |
| 66 BAR_SLOW_HUE = 220 | 67 BAR_SLOW_HUE = 220 |
| 67 BARS = ["hpm", "hpb"] | 68 BARS = ["hpm", "hpb"] |
| 310 | 311 |
| 311 def check_config(cfg): | 312 def check_config(cfg): |
| 312 """raise ConfigError on missing or malformed settings.""" | 313 """raise ConfigError on missing or malformed settings.""" |
| 313 for sec in ("scale", "monster", "animation", "movement", "route_preference", "tower", | 314 for sec in ("scale", "monster", "animation", "movement", "route_preference", "tower", |
| 314 "placement", "waves", "hearts", "coins", "controls", "art", "debug", | 315 "placement", "waves", "hearts", "coins", "controls", "art", "debug", |
| 315 "sound", "map"): | 316 "sound", "links", "map"): |
| 316 if sec not in cfg: | 317 if sec not in cfg: |
| 317 raise ConfigError(f"section [{sec}] missing") | 318 raise ConfigError(f"section [{sec}] missing") |
| 318 for mid, mon in cfg["monster"].items(): | 319 for mid, mon in cfg["monster"].items(): |
| 319 for k in ("hp", "coins", "speed"): | 320 for k in ("hp", "coins", "speed"): |
| 320 need(mon, k, float, f"monster.{mid}") | 321 need(mon, k, float, f"monster.{mid}") |
| 321 for tid, tw in cfg["tower"].items(): | 322 for tid, tw in cfg["tower"].items(): |
| 322 for k in TOWER_BY_LEVEL: | 323 for k in TOWER_BY_LEVEL: |
| 323 if k == "slow" and k not in tw: | 324 if k in ("slow", "damage") and k not in tw: |
| 324 continue | 325 continue |
| 325 v = need(tw, k, list, f"tower.{tid}") | 326 v = need(tw, k, list, f"tower.{tid}") |
| 326 if len(v) != 2 or not all(isinstance(x, (int, float)) and not isinstance(x, bool) | 327 if len(v) != 2 or not all(isinstance(x, (int, float)) and not isinstance(x, bool) |
| 327 for x in v): | 328 for x in v): |
| 328 raise ConfigError(f"tower.{tid}: {k} should be [level 1, level " | 329 raise ConfigError(f"tower.{tid}: {k} should be [level 1, level " |
| 329 f"{TOWER_LEVELS}], is {v!r}") | 330 f"{TOWER_LEVELS}], is {v!r}") |
| 330 for k in ("attack_time", "projectile_speed"): | 331 for k in ("attack_time", "projectile_speed"): |
| 331 need(tw, k, float, f"tower.{tid}") | 332 need(tw, k, float, f"tower.{tid}") |
| 332 need(tw, "projectile", str, f"tower.{tid}") | 333 need(tw, "projectile", str, f"tower.{tid}") |
| 334 if "splash_radius" in tw: | |
| 335 need(tw, "splash_radius", float, f"tower.{tid}") | |
| 336 for k in ("logo_url", "email", "email_subject"): | |
| 337 need(cfg["links"], k, str, "links") | |
| 333 for k in ("speed_variation", "offset", "lean", "wander_step", "fade_in"): | 338 for k in ("speed_variation", "offset", "lean", "wander_step", "fade_in"): |
| 334 need(cfg["movement"], k, float, "movement") | 339 need(cfg["movement"], k, float, "movement") |
| 335 for k in ("footprint_radius", "max_gap", "min_tower_distance", "edge_distance", | 340 for k in ("footprint_radius", "max_gap", "min_tower_distance", "edge_distance", |
| 336 "snap_radius", "grid_cell"): | 341 "snap_radius", "grid_cell"): |
| 337 need(cfg["placement"], k, float, "placement") | 342 need(cfg["placement"], k, float, "placement") |
