Increasing speed of certain on-going animations (MoveTo , RotateTo)

Increasing speed of certain on-going animations (MoveTo , RotateTo)
0.0 0


Hi everyone,
My game involves using vehicles to catch the opponent. Vehicles travel in a fixed path (Route). Movement is done using MoveTo and RotateTo actions. Now I plan to add power-ups to the game. One such power-up is increasing speed of the boarded vehicle for few seconds. If I had implemented movement manually in update method, then this would have been simple. But since I am using MoveTo and RotateTo actions, implementing this power-up seems to be a bit tricky. I am aware of setTimeScale method but that will speed up all animations present in the game. Is there something similar that increases/reduces speed of only selected animations?



Try this example:

 Speed* spd = Speed::create(MoveTo::create(10.0f, Vec2(2000,0)), 1.0f);


Why not just increase the speed? All Actions have this.

Example from our Programmers Guide:

auto mySprite = Sprite::create("mysprite.png");

// Move a sprite to a specific location over 2 seconds.
auto moveTo = MoveTo::create(2, Vec2(50, 0));


// Move a sprite 50 pixels to the right, and 0 pixels to the top over 2 seconds.
auto moveBy = MoveBy::create(2, Vec2(50, 0));



that is what I was looking for. I will mark question as Solved once I get time to implement this. Thanks.


I wanted a way to change the speed while the animation is in progress. The answer provided by sevent7 works