Libgdx Actions => gradually move Actor from point A to point B

libgdx

Solution

The second form:

addAction(Actions.moveTo(posX, posY, 10)));

should move your actor to posX, posY over the course of 10 seconds.

The first form will move the actor 1-step in x and y, and after that completes move the actor immediately to posX, posY. `Actions.sequence` runs the given actions one after the other, they do not modify each other.

How (and where) are you calling `act()` on the stage? That is what determines how much to update an `Actor` in a frame, so if you call it multiple times per frame or pass the wrong value, the actions will pass too quickly.

Problem

I want to gradually animate my Actor. I added this Action to move Actor from point A to point B. ``` addAction(Actions.sequence(Actions.moveBy(1, 1), Actions.moveTo(posX, posY))); ``` Also tried this (moveTo in 10 seconds): ``` addAction(Actions.moveTo(posX, posY, 10))); ``` But Actor moves too fast. What's wrong?

Original source