Skip to main content

Animated Sprites

Sprites can be animated by providing a sprite sheet and a frame rate.

const sprite = new TSpriteComponent({
width: 12 * 4,
height: 24 * 4,
origin: TOriginPoint.Center,
layer: TSpriteLayer.Foreground_0,
});
const animation = new TAnimatedSpriteComponent(10, 9);

this.world.createEntity([
sprite,
animation,
new TTextureComponent(engine.resources.get<TTexture>(personTexture)!),
]);

animation.paused = !animation.paused;