sprite ai
Assert World Pivot Stability When Swapping an AI Sprite Pose
When a gameplay actor swaps between AI-generated poses, keep its turning angle and world pivot in the actor state, separate from the image name. That lets a runtime check prove that a new image inherits the orientation rather than appearing upright for a frame. The test should look at the rendered pixels, because an exposed angle value can remain correct even when a replacement surface is no longer rotated.
Start with two deliberately different rectangular poses on identical canvases. Give each a colored dot on just one side of the declared pivot. At a right-angle turn, record the rendered width and height and plot a marker where the world pivot belongs. Swap the image, redraw without moving the actor, and compare the pose dot to that marker. Test both directions of the swap so the test catches an update routine applied to only one pose.
The technical guide and test fixture shows a Pygame Zero 1.2.1 case where assigning a new image leaves the stored angle unchanged but resets the drawn aspect, and assigning the angle again restores rotation. Turn that into a visual regression near the runtime update rather than relying on a contact sheet built without rotation.
Prepared by the FrameSprite Workflow Team with AI assistance. Examples are illustrative unless attributed to a linked fixture.