Files
mortal-maze-the-game/docs/pixel_combat.md
T

79 lines
4.1 KiB
Markdown

# Pixel combat pass
Apply this patch after `fix_player.patch` and `fix_level_02.patch`.
It does not reapply or undo either fix.
## Art and scale
The four existing CharacterData resources still share the same SpriteFrames.
Their existing references and the SpriteFrames UID are retained. The old PNGs
are not deleted; the new resource uses `assets/characters/ankarde/player_pixel.svg`.
This is a self-contained pixel atlas (integer coordinates, flat palette), matching
the SVG pixel style of the enemies. No external fonts, plugins or image files are
needed to build the atlas.
There are 37 frames in 11 animations: idle, walk, jump, fall, punch, ground pound,
land, special start, special loop, special end and hurt. Cells are 64 x 64 pixels,
with the standing character approximately 56 pixels tall. Nearest filtering and
1:1 sprite scale avoid smoothing. The body and hurtbox change from 41 x 74 to
26 x 52, comparable to the enemies' 28 x 52 bodies. Jump and movement stats are
unchanged. The punch area and ground-pound origin follow the new proportions.
## Combat behaviour
- Punch: 0.28-second animation, 0.055-second windup and 0.11-second active window.
A target takes one hit per punch. The 0.34-second cooldown is enforced.
- Ground pound: dedicated falling pose, squash on landing, ground-space dust,
cracks and an expanding impact ring. Damage remains capped at 7-12. The impact
queries the hurtboxes at the resolved landing position rather than the previous
physics frame's cached Area2D overlaps.
- Special: 2.4 seconds by default, with four pulses at 0.36, 0.88, 1.40 and 1.92
seconds. The player draws a guitar, plays the solo and lowers it afterwards.
Movement, jump and other attacks are locked during the solo, except for recoil
and incoming knockback. No extra invulnerability is granted.
- All current charge is consumed once, on activation. Kills during the solo can
recharge the next attack; recasting during the current solo is blocked.
- The original damage budget is distributed across the pulses, NOT applied four
times. Cumulative rounding avoids losing points or imposing one point per pulse
on a tiny budget. The per-target budget is fixed on first contact. Enemies must
still be on screen and within special_radius to receive each pulse, so escaping
its range can avoid later damage. The existing per-level radius is preserved.
- Enemies flash on impact and retain knockback. At zero HP, logical death and the
existing rewards happen immediately once. Combat collisions stop, while the
body launches, falls against the world, collapses and fades for 0.9 seconds.
Dead nodes remain available to the levels' KO polling and total-enemy counts.
Respawn still works and restores the sprite transform, opacity and collisions.
Effects are independent of the debug-hitbox flags. They use lightweight transient
world-space nodes and a non-interactive screen overlay below the HUD. Effects
clean themselves up. No new music or guitar audio is included in this visual pass.
## Adjustments in the Inspector
- Player: special_duration, special_pulse_count and existing special_radius.
- Camera2D: feedback_strength from 0 to 1. Zero disables both screen overlays and
camera shake. Shake is capped at three world pixels; there are no white flashes.
- Enemy: death_animation_duration. Respawn delay remains measured from logical death.
## Checks
Engine-independent resource checks:
```sh
python -m unittest discover -s tests -v
```
Import the new SVG and register scripts, then run engine integration checks:
```sh
godot --headless --path . --editor --import
godot --headless --path . --script res://tests/test_level_02_runtime.gd
godot --headless --path . --script res://tests/test_pixel_combat_runtime.gd
```
The combat check exercises scene/texture loading, charge consumption, delayed and
bounded pulse damage, recoil, death visibility, one-time rewards, respawn state
and the 12-point ground-pound cap. This headless check is not a visual playtest.
In the editor, run Level02 and check W (jump), J (punch), K (air ground pound) and
L (charged guitar solo), including left-facing attacks and mobile controls.