Package org.collebol.shared
Class Sprite
java.lang.Object
org.collebol.shared.Sprite
Represents a sprite animation composed of multiple frames.
A sprite consists of one or more texture frames that are displayed sequentially
to create an animation. Each frame is identified by a texture ID previously
registered in the
TextureRenderer. The sprite updates its current frame
automatically based on the elapsed time and the specified frame duration.
Sprites are designed to be attached to GameObject
instances. When a GameObject has a Sprite, the rendering system will
use the sprite's current frame instead of a static texture.
Usage:
Sprite sprite = new Sprite(new Sprite.SpriteBuilder()
.frames(new int[]{1, 2 etc.}) // The ID's of the textures
.duration(1f) // 1f for 1 sec. 0.25f for 1/4th of a sec etc.
);
- Since:
- 1.0-dev
- Author:
- ColleBol - contact@collebol.org
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Method Details
-
update
public void update(float deltaTime) -
getElapsedTime
public float getElapsedTime() -
getCurrentFrameId
public int getCurrentFrameId() -
getFrameDuration
public float getFrameDuration() -
getFrameIds
-