-
Notifications
You must be signed in to change notification settings - Fork 0
Making a Sprite
bapquad edited this page Feb 28, 2022
·
2 revisions
This guide show you how to make a static sprite and anime sprite with CaremJS.
You can create a static sprite with StaticSprite
class.
let fish = new Carem.StaticSprite(asset, 0, 0, 201, 120, scene);
The static sprite works with physics and world limit default.
fish.SetGravity(2.0);
fish.EnableGravity();
The anime sprite need a image with frames of animation like as below figure.
After loaded completely, you can assign the image into the anime sprite.
let fish = new Carem.AnimeSprite(asset, 198, 114, scene);
You should create the action constants for use actions
this.actions = [0, 1];
fish.SetAction(this.actions[1]);
With the 0
value, it use first row of frames.