acron.sprite2d

Sprite2D / AnimatedSprite2D – textured cards in the canvas2d frame.

AnimatedSprite2D plays named flip-book animations (SpriteAnimation dicts) on its own clock (advance from the fixed loop or a per-frame task). The animation dicts are plain data; the Godot SpriteFrames parsers that produce them live in acron.gdformat.sprite_frames. Pixel-art defaults: nearest-neighbour filtering, alpha transparency.

Godot semantics kept: flip_h/flip_v; centered (default True); offset; play(name)/stop; animation_finished signal for non-looping animations; modulate via set_color_scale.

AnimatedSprite2D(parent, frames[, autoplay, ...])

Flip-book sprite over a SpriteFrames dict; drive with advance().

FrameDef(texture[, region, duration])

One flip-book frame: a texture, optionally an atlas sub-region.

Sprite2D(parent, texture_path[, centered, ...])

A single-texture card.

SpriteAnimation(name, speed, loop, frames)

One named flip-book animation: its fps, loop flag, and frame list.

Global Functions

first_playable(frames: dict, *preferred: str)

The first of preferred that exists AND has frames, else any non-empty animation, else None.

Shipped SpriteFrames routinely declare EMPTY animations (scannot ships walk/jump with no frames at all); parking a sprite on one draws nothing.

load_texture_nearest(path: str)

Load a texture with nearest (pixel-art) filtering; None if missing.