PointClickEngine::Graphics::Sprites::AnimatedSprite
Inherits PointClickEngine::Graphics::Sprites::Sprite < Reference < Object
Animated sprite with frame-based animation support
AnimatedSprite extends the base Sprite class to support sprite sheet animations with configurable timing, looping, and playback control.
Example
# Create an 8-frame walk animation
sprite = AnimatedSprite.new("assets/character_walk.png", 64, 64, 8)
sprite.frame_duration = 0.1 # 10 FPS
sprite.play
# One-shot animation
explosion = AnimatedSprite.new("explosion.png", 128, 128, 12)
explosion.loop = false
explosion.on_complete do
scene.remove_object(explosion)
end
Constructors
new(x : Float32, y : Float32, texture_path : String, frame_width : Int32, frame_height : Int32, frame_count : Int32)
Initialize at position
new(texture_path : String, frame_width : Int32, frame_height : Int32, frame_count : Int32)
Initialize with sprite sheet
Instance methods
current_frame
Sourcecurrent_frame=(current_frame : Int32)
Sourceframe_count
Sourceframe_count=(frame_count : Int32)
Sourceframe_duration
Sourceframe_duration=(frame_duration : Float32)
Sourceframe_height
Sourceframe_height=(frame_height : Int32)
Sourceframe_speed
Sourceloop
Sourceloop=(loop : Bool)
Sourceplaying
Sourceplaying=(playing : Bool)
Source