implementation Global acceleration and deceleration
local multi = 0.2
cc.Director:getInstance():getScheduler():setTimeScale(multi)
--The parameter multi is the meaning of magnification, and the default is 1. The higher the magnification, the faster the speed.
--If you need to double the speed to achieve the acceleration effect, you can set multi to 2.0f.
Yes Accelerate or decelerate in a single action
local act = cc.Speed:create(self.jumpAction,2)--play action at 2 times speed
self .nodeMap["imgGuang"]:runAction(act)
implementation Global acceleration and deceleration
local multi = 0.2
cc.Director:getInstance():getScheduler():setTimeScale(multi)
--The parameter multi is the meaning of magnification, and the default is 1. The higher the magnification, the faster the speed.
--If you need to double the speed to achieve the acceleration effect, you can set multi to 2.0f.
Yes Accelerate or decelerate in a single action
local act = cc.Speed:create(self.jumpAction,2)--play action at 2 times speed
self .nodeMap["imgGuang"]:runAction(act)
Animation is one of the inevitable elements of the game, in the whole game process , There is also a need for acceleration and deceleration animation. Take tower defense as an example. When you set up a tower, you want to slow down the game. After you set up the tower, you want to speed up the game. When a monster is frozen, its movement speed slows down, while the other monsters move at the same speed.
Realize global acceleration and deceleration
By setting the timeScale of Scheduler, global acceleration and deceleration can be achieved. The speed of the game can be controlled by the director.
Through such a mechanism, the in-game combat multiplier can be accelerated.
accelerate or decelerate individual actions
< /p>
Achieved by cc.speed