Cocos2d_x + Lua [10] -- Use of scenario switching Effects

Source: Internet
Author: User

Odustggg Personal Original, welcome to reprint, reprint please indicate the source, http://blog.csdn.net/odustggg/article/details/8197289

I. Introduction to switching results

Cocos2d_x provides a large number of scenario switching effects, you do not need to implement it yourself, basically meet the requirements of daily development,
The first scenario in the game, pdirector: runwithscene (scene), can appear in the corresponding scenario,
To switch the scenario, use ccdirector: shareddirector (): replacescene (scene) to replace it with the new scenario,
If you want to implement a non-monotonous switching effect, you need to implement the corresponding switching method to generate the corresponding scenario.
Then, use ccdirector: shareddire(): replacescene (scene) to start the scenario and the scenario transition will not be too ugly.

2. provide results

-- In the original scenario, the jump is reduced first, and the new scenario jumps forward. cctransitionjumpzoom: transitionwithduration (t, s) -- the original scene fades out, new scene fades in, and the third parameter is the fade out color. When omitted, the default value is black cctransitionfade: transitionwithduration (t, s, ccwhite) -- fade-out crossover and cctransitioncrossfade: transitionwithduration (t, s) at the same time -- the new scenario covers the original scenario (with good results) in various aspects: transitionwithduration (t, s) cctransitionmoveinr: transitionwithduration (t, s) cctransitionmoveint: transitionwithduration (t, s) cctransitionmoveinb: transitionwithduration (t, s) -- the new scene is moved from various directions to bring the original scene to the screen (I personally think this effect is not very good) cctransitionslideinl: transitionwithduration (t, s) cctransitionslideinr: transitionwithduration (t, s: transitionwithduration (t, s) gradient: transitionwithduration (t, s) -- wave, shutter, random small square gradient: transitionwithduration (t, s) cctransitionfadebl: transitionwithduration: transitionwithduration (t, s) cctransitionfadedown: transitionwithduration (t, s) failed: transitionwithduration (t, s) -- partition by column: transitionwithduration (t, s) failed: transitionwithduration (t, s) -- switch to cctransitionradialccw: transitionwithduration (t, s) cctransitionradialcw: transitionwithduration (t, s) -- The results of X-axis flip and Y-axis flip, 0 and 1 parameters respectively are not very good. -- in the C ++ project, there are no problems in testing and Lua. all functions with a flip effect will have a screen image and the cause is unknown. If you have any idea, please leave a message to inform us, and you are not very grateful for the cctransitionflipx: transitionwithduration (t, s, 0) cctransitionflipy: transitionwithduration (t, s, 0) -- angular conversion cctransitionflipangular: transitionwithduration (t, s, 0) -- cctransitionzoomflipx: transitionwithduration (t, s, 0) on the X axis with scaling effect -- cctransitionzoomflipy: transitionwithduration (t, s, 0) on the Y axis with scaling effect) -- cctransitionzoomflipangular with zoom/angle rotation: transitionwithduration (t, s, 0) -- the original scenario is gradually becoming smaller, and the new scenario is gradually becoming larger. cctransitionshrinkgrow: transitionwithduration ); -- Switch angle to cctransitionrotozoom: transitionwithduration (t, s); -- front and back pages, poor personal experience failed: transitionwithduration (t, s, false) failed: transitionwithduration (t, s, true)

For more information, see tests in the engine.
Iii. Usage

runningScene = CCDirector:sharedDirector():getRunningScene() local trans = CCTransitionFade:transitionWithDuration(1.5,nextScene)if runningScene == nil then CCDirector:sharedDirector():runWithScene( trans )     else  CCDirector:sharedDirector():replaceScene( trans ) end

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.