settings.py¶
Part of HeartBeast Action RPG.
1"""Game-wide constants for the HeartBeast Action RPG port.
2
3Mirrors the upstream HeartBeast tutorial's tuning values, expressed in SimVX
4idioms (seconds, radians, numpy Vec2). No art is bundled: every entity is a
5handful of ``draw_circle`` / ``draw_rect`` / ``draw_polygon`` calls, so the
6palette lives here alongside the tuning numbers.
7"""
8
9from __future__ import annotations
10
11# ── Window ───────────────────────────────────────────────────────────────────
12# 320x180 world pixels (the HeartBeast original) shown at 4x, so the window is
13# 1280x720. The camera zooms a little less than that, which keeps a 16 px world
14# tile comfortably readable while still showing a useful slice of the map.
15BASE_WIDTH = 320
16BASE_HEIGHT = 180
17SCALE = 4
18WIDTH = BASE_WIDTH * SCALE # 1280
19HEIGHT = BASE_HEIGHT * SCALE # 720
20CAMERA_ZOOM = 3.0
21
22# ── World ────────────────────────────────────────────────────────────────────
23# World units are the upstream 16 px tiles, so the field is 4x wider and 3.5x
24# taller than one screenful: the camera has somewhere to scroll.
25TILE_SIZE = 16
26WORLD_WIDTH_TILES = 80
27WORLD_HEIGHT_TILES = 40
28WORLD_WIDTH = WORLD_WIDTH_TILES * TILE_SIZE # 1280
29WORLD_HEIGHT = WORLD_HEIGHT_TILES * TILE_SIZE # 640
30
31# ── Player ───────────────────────────────────────────────────────────────────
32PLAYER_SPEED = 100.0 # px/sec (matches upstream move speed)
33PLAYER_ACCELERATION = 500.0 # px/sec^2, ramp up to full speed
34PLAYER_FRICTION = 1000.0 # px/sec^2, ramp down to a stop
35PLAYER_ROLL_SPEED = 250.0 # px/sec
36PLAYER_ROLL_DURATION = 0.3 # seconds
37PLAYER_INVULN_DURATION = 1.0 # seconds
38PLAYER_MAX_HP = 6 # hearts (matches upstream)
39PLAYER_ATTACK_DURATION = 0.25 # seconds
40PLAYER_ATTACK_COOLDOWN = 0.4 # seconds
41PLAYER_ATTACK_DAMAGE = 1 # damage per sword hit
42PLAYER_RADIUS = 6.0 # px, drawn body radius
43PLAYER_RESPAWN_DELAY = 2.0 # seconds face-down before reviving
44
45# ── Enemy (Bat) ──────────────────────────────────────────────────────────────
46ENEMY_SPEED = 40.0 # px/sec
47ENEMY_CHASE_SPEED = 70.0 # px/sec when chasing
48ENEMY_MAX_HP = 3 # hits to kill
49ENEMY_DAMAGE = 1 # damage per touch on the player
50ENEMY_INVULN_DURATION = 0.8 # seconds
51ENEMY_DETECTION_RADIUS = 120.0 # px
52ENEMY_WANDER_TIMEOUT = 2.0 # seconds before picking a new wander target
53ENEMY_SOFT_COLLISION_RADIUS = 12.0 # px
54
55# ── Hitboxes ─────────────────────────────────────────────────────────────────
56PLAYER_HURTBOX_RADIUS = 6.0 # px
57ENEMY_HURTBOX_RADIUS = 6.0 # px
58SWORD_HITBOX_SIZE = (14, 12) # px
59SWORD_HITBOX_OFFSET = (11, 0) # px from the player centre, along the facing
60
61# ── Effects ──────────────────────────────────────────────────────────────────
62HIT_EFFECT_DURATION = 0.3 # seconds
63DEATH_EFFECT_DURATION = 0.5 # seconds
64GRASS_EFFECT_DURATION = 0.3 # seconds
65
66# ── Grass ────────────────────────────────────────────────────────────────────
67GRASS_HURTBOX_RADIUS = 6.0 # px
68
69# ── Colours (RGBA 0..1 floats) ───────────────────────────────────────────────
70COLOUR_GRASS = (0.30, 0.55, 0.20, 1.0)
71COLOUR_GRASS_BLADE = (0.42, 0.72, 0.24, 1.0)
72COLOUR_DIRT = (0.45, 0.30, 0.15, 1.0)
73COLOUR_HEART_FULL = (0.85, 0.15, 0.15, 1.0)
74COLOUR_HEART_EMPTY = (0.30, 0.10, 0.10, 1.0)
75COLOUR_UI_BG = (0.06, 0.08, 0.07, 0.82)
76COLOUR_UI_TEXT = (0.95, 0.96, 0.92, 1.0)
77COLOUR_UI_TEXT_DIM = (0.72, 0.78, 0.70, 1.0)
78COLOUR_WHITE = (1.0, 1.0, 1.0, 1.0)
79
80# Player: pale tunic, dark hair, skin-toned face, so the facing is readable.
81COLOUR_PLAYER_BODY = (0.29, 0.42, 0.78, 1.0)
82COLOUR_PLAYER_TRIM = (0.16, 0.24, 0.48, 1.0)
83COLOUR_PLAYER_HEAD = (0.96, 0.80, 0.62, 1.0)
84COLOUR_PLAYER_HAIR = (0.35, 0.22, 0.12, 1.0)
85COLOUR_SWORD = (0.92, 0.94, 1.0, 0.85)
86COLOUR_SHADOW = (0.0, 0.0, 0.0, 0.22)
87
88# Bat: near-black body, purple wings, red eyes.
89COLOUR_BAT_BODY = (0.16, 0.13, 0.20, 1.0)
90COLOUR_BAT_WING = (0.36, 0.25, 0.45, 1.0)
91COLOUR_BAT_EYE = (0.95, 0.25, 0.25, 1.0)