Sprite Production Field Notes

sprite sheet maker

Keep a Delayed Sprite Cue Alive After Its Scheduling Function Exits

A delayed burst or footstep may be scheduled inside a short helper. If the scheduler only holds a weak reference and the helper owns the last strong reference, the cue can disappear while the sprite animation continues. Tie the callback's lifetime to the action or controller that should own it.

Check both delivery and cancellation

Make a test action that schedules a cue and exits its setup function. Force a collection pass, advance beyond the deadline, and require the cue to appear once in the event log. Then cancel another action before its deadline. Advance time again and verify no cancelled cue appears. Release the retained callback when it is no longer eligible, so the remedy does not accumulate a callback for every shot or footsteps sequence. Use a separate event identity to distinguish the cancelled action from a later replacement.

The technical guide and test fixture records a native Pygame Zero clock fixture where a retained callback outlives an inline lambda even though both share a delay. Running the callback directly is a poor regression for this issue. The test should cross the actual scheduling boundary and the end of the setup function's scope.

Prepared by the FrameSprite Workflow Team with AI assistance. Examples are illustrative unless attributed to a linked fixture.