How to play a certain number of animation frames?

In my game, an object accumulates force to jump, the animation consists of 12 frames, with each frame the object is flattened, the holding time affects the force of the jump.

How can I control the number of frames played? For example, if you have accumulated the maximum force of a jump, then the animation is played in full; if you press and release, then only, for example, the first two or three frames.

I play the jump animation through tilesource, where start tile 1 and end tile 12, playback once forward.

In this case, I’d assume you’d just replace the current animation with the new one (i.e. the “jump” animation)?

In any case, we currently have no way of knowing the current frame of an animation.
We do have the “cursor”, which is between 0 and 1:

local cursor = go.get("#sprite", "cursor")
1 Like


Is it possible to control frames using cursor? For example, 8 frames, make them dependent on the strength of the jump, where half the strength is 4 frames, full strength is 8 frames, the minimum strength is 1-2 frames (conventionally, this is a prototype)

Yes:

The cursor, is in “unit” time. 0 means start of animation, 1 means end of animation.

2 Likes

Thanks!
:heart: