megadev-animation
Megadev animation
Start with the game's existing simulation clock, action state and renderer. Megadev does not supply SGDK's sprite animation API. The Lab's an_* and tr_* routines are application code, not SDK functions.
Author a timeline, not a drawing-side timer
Use clips and timing for named clips, per-frame holds, loop/terminal behavior and completion semantics. Advance playback from the existing game steps. A renderer may skip intermediate poses; it must not decide which gameplay events happened.
Keep logical frames separate from stored graphics. Several frames can reference one pose with different holds or events, without duplicating image patterns. Check frame ranges and duration bounds before selecting a clip. Avoid restarting the current walk/idle clip on every update.
Make transition rules explicit
Use events and interruption for event identity, state priority, cancellation, terminal poses and one-hit contracts. Consume entry/completion events during the simulation step where they occur. If events are queued, carry the originating action identity and discard stale work after interruption.
A sword pose and its active hitbox should describe the same reach. Test collision on every simulation step, then apply per-action/per-target damage policy. Invulnerability, guards, combos and balance belong to gameplay/combat rules; an animation frame alone does not authorize damage.
Integrate through existing owners
Read Megadev integration before adding playback to a project. Reuse its clock, input, VDP publication, audio and residency policies. Animation does not need one timer, allocation or Sub job per actor. Additional CPUs and disc space do not remove VRAM, sprite or upload limits.