Sprites and Animations Internals¶
Purpose¶
Explain how texture-backed entities and frame animations fit into the same entity/render pipeline as shape-only entities.
Core files¶
packages/mini-arcade-core/src/mini_arcade_core/engine/components.pypackages/mini-arcade-core/src/mini_arcade_core/engine/animation.pypackages/mini-arcade-core/src/mini_arcade_core/scenes/systems/builtins/__init__.py
Sprite component¶
Sprite2D is just:
one texture id
If it exists on the entity, the built-in renderer draws that texture using the entity transform for:
position
size
rotation
Animation component¶
Anim2D wraps an Animation object and caches the current frame texture.
Important detail:
the renderer only draws the current cached texture
a simulation system must call
anim.step(dt)to advance frames
Runtime flow¶
create or load textures
store ids in
sprite.textureoranim.framesadvance
Anim2Din a system if animation is usedbuilt-in rendering picks
anim.texturefirst, thensprite.texture
Tutorial references¶
docs/source/tutorials/entity/sprite_texture_basics.mddocs/source/tutorials/entity/animation_frames_basics.md