[IOS-Cocos2d game development 3] All the effects of ccscene switching (28) and set the screen portrait!

Source: Internet
Author: User

Li huaming himiOriginal, reprinted must be explicitly noted:
Reprinted from[Heimi gamedev block]Link: http://www.himigame.com/iphone-cocos2d/423.html

Ccscene must be familiar with cocos2d shoes. Therefore, when using [[ccdirectorsharedctor ctor] replacescene: <# (ccscene *) scene #>], perform scenario (cclayout) on scene) during the switchover, cocos2d provides some special effects for the Transition. Today, we carefully turn on the cocos2d source code and test all the animation effects, which are roughly sorted as follows, for more information, see and use;

Because I am using the latest cocos2d Version 1.0, so some function methods are different from before, so don't be surprised;

Because the Code has comments, you can directly add the code without further explanation. The comments are my intuitive experience. We recommend that you put them in your project, let's take a look at each of the results. This is a deep memory;

// Touch event-method called when the finger is lifted from the screen-himi-(void) cctouchesended :( nsset *) touches withevent :( uievent *) event {ccscene * scenec = [otherlayout scene]; // blog ------ // cctransitionturnofftiles * transitionscene = [cctransitionturnofftiles transitionwithduration: 3 scene: scenec]; // near-distance ----- // cctransitionshrinkgrow * transitionscene = [cctransitionshrinkgrow transitionwithduration: 3 scene: scenec]; // the left side of the other layout is displayed (the screen is shifted to the right) // transfer* transitionscene = [transfertransitionwithduration: 3 scene: scenec]; // enter the right side of another layout (the visual feeling is that the screen is moved left) // cctransitionslideinr * transitionscene = [transfertransitionwit: 3 scene: scenec]; // The other layout top-side access (visual perception is screen down) // cctransitionslideint * transitionscene = [cctransitionslideint transitionwithduration: 3 scene: scenec]; // another layout lower-side entry (visual perception is screen-up) // cctransitionslideinb * transitionscene = [cctransitionslideinb transitionwithduration: 3 scene: scenec]; // The current screen is divided into three columns, two moves down, middle move up // cctransitionsplitcols * transitionscene = [cctransitionsplitcols transitionwithduration: 3 scene: scenec]; // The current screen is divided into three columns, and the two move left, middle right shift // required * transitionscene = [audio transitionwithduration: 3 scene: scenec]; // sector conversion ----- // required * transitionscene = [audio transitionwithduration: 3 scene: scenec]; // plane rotation ----- // required * transitionscene = [cctransitionrotozoom transitionwithduration: 3 scene: scenec]; // near-far-beat ------ // required * transitionscene = [transfer transitionwithduration: 3 scene: scenec]; // stereoscopic inversion (X axis) -- (there is also a feeling from near to far, from far to near) -------- // cctransitionzoomflipx * transitionscene = [effectransitionwithduration: 3 scene: scenec]; // stereoscopic inversion (Y axis)-(there is also a feeling of going from near to far, from far to near) ------- // cctransitionzoomflipy * transitionscene = [Semi transitionwithduration: 3 scene: scenec]; // stereoscopic inversion (X, Y axis) --- (there is also a feeling of going from near to far, from far to near) ----- // cctransitionzoomflipangular * transitionscene = [effectransitionwithduration: 3 scene: scenec]; // enter the left side of the other layout to overwrite the current layout // cctransitionmoveinl * transitionscene = [cctransitionmoveinl transitionwithduration: 3 scene: scenec]; // enter the right side of another layout to overwrite the current layout // cctransitionmoveinr * transitionscene = [cctransitionmoveinr transitionwithduration: 3 scene: scenec]; // overwrite the current layout on the other layout. // cctransitionmoveint * transitionscene = [cctransitionmoveint transitionwithduration: 3 scene: scenec]; // the lower side of the layout overwrites the current layout // cctransitionmoveinb * transitionscene = [cctransitionmoveinb transitionwithduration: 3 scene: scenec]; // three-dimensional inversion (X axis) -- 2D plane inversion, no sense of distance // cctransitionflipx * transitionscene = [cctransitionflipx transitionwithduration: 3 scene: scenec]; // three-dimensional inversion (Y axis) -- 2D plane inversion, no sense of distance // cctransitionflipy * transitionscene = [cctransitionflipy transitionwithduration: 3 scene: scenec]; // three-dimensional inversion (X, Y axis) -- 2D plane inversion, no sense of distance // cctransitionflipangular * transitionscene = [cctransitionflipangular transitionwithduration: 3 scene: scenec]; // entity-transparent-entity (color-included by default) // cctransitionfade * transitionscene = [cctransitionfade transitionwithduration: 3 scene: scenec withcolor: ccwhite]; // another direct gradient will overwrite the current layout // transfer* transitionscene = [upload progress: 3 scene: scenec]; // move (grid-like) blog, from bottom left to top right // cctransitionfadetr * transitionscene = [cctransitionfadetr transitionwithduration: 3 scene: scenec]; // move (grid-like) the groove, from top right to bottom left cctransitionfadebl * transitionscene = [cctransitionfadebl transitionwithduration: 3 scene: scenec]; // move (long rectangle, width is screen width) blog, from bottom up // cctransitionfadeup * transitionscene = [cctransitionfadeup transitionwithduration: 3 scene: scenec]; // move (long rectangle, width is screen width) blog, from top down // cctransitionfadedown * transitionscene = [cctransitionfadedown transitionwithduration: 3 scene: scenec]; [[ccdirector shareddirerepl] replacescene: transitionscene];}

The above code himi recommends that you use common sense to run each special effect. After all, everyone has a different feeling. Comments are all written by me. I just commented on them;

Next, I will introduce how to set up a portrait screen display in cocos2d 1.0, because the default screen is a landscape screen;

First find the rootviewcontroller. M class (this class exists in version 1.0), and then find a piece of macro-defined code, the code is as follows:

# Elif game_autorotation = kgameautorotationuiviewcontroller

The default code for cocos2d is to set a horizontal screen:

return ( UIInterfaceOrientationIsLandscape( interfaceOrientation ) );

If you want to set the portrait screen, change it as follows:

return (UIInterfaceOrientationIsPortrait(interfaceOrientation));

OK. We will introduce you here today ~ Continue Learning ~ The following is a blog effect, which is a special switching effect from the lower left to the upper right;

 

Related Article

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.