[COCOS2DX_LUA] Animation Acceleration and Deceleration

Animation It is one of the inevitable elements of the game. During the entire game process, has the 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.

implementation Global acceleration and deceleration

< span style="color:#FF0000;">By setting the timeScale of Scheduler, global acceleration and deceleration can be achieved. The speed of the game can be controlled by the director.
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.
Through such a mechanism, the in-game combat multiplier can be accelerated.

Yes Accelerate or decelerate in a single action

Realized by cc.speed
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. During the entire game process, has the need to accelerate and decelerate animation em>. 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.

implementation Global acceleration and deceleration

< span style="color:#FF0000;">By setting the timeScale of Scheduler, global acceleration and deceleration can be achieved. The speed of the game can be controlled by the director.
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.
Through such a mechanism, the in-game combat multiplier can be accelerated.

Yes Accelerate or decelerate in a single action

Realized by cc.speed
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

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3697 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.