Study Notes on cocos2d-x (8)-Special scene Effects

Source: Internet
Author: User

Small man (Bill man) Personal Original, welcome to reprint, reprint please indicate the address, small man (Bill man) column address http://blog.csdn.net/bill_man

How can we make all the scenes affected by an action special effect? You can use the tree structure to create a ccnode in the scenario, and then place all the objects affected by the special effect in the scenario on this special effect. The following code can achieve this.


We can see that all objects are attached to the node. In addition, when the special effect action ends, the scenario can be restored to normal. You can use schedule to perform real-time monitoring as follows:


As in the Code, if the action ends, the corresponding status will be restored and setgrid will be empty.

The special effects used in test are as follows:

First, use CCG (x, y) to create a grid. A grid attribute is like a matrix, a network line, and a series of squares and matrices. A () grid will run very fast, but it will not look very good. () Will look very good, but in the one1 generation, it will not run too fast. The frame on any screen is renamed as a texture (FBO). The texture is converted to a vertex array, which is converted by the grid effect. Finally, the vertex array is displayed on the screen.

Ccshaky3d: actionwithrange (5, true, CCG (15, 10), T); // The first parameter is the distortion range, the second parameter is the distortion Z axis, and the shard size, the fourth parameter is the interval.

Ccwaves3d: actionwithwaves (5, 40, CCG (20, 10), T); // wavy, 5 is the number of waves, 40 is the amplitude

Ccflipx3d: actionwithduration (t); // flip the X axis

Ccflipy3d: actionwithduration (t); // flip the Y axis

Cclens3d: actionwithposition (ccpointmake (size. width/2, size. height/2), 240, CCG (), T); // magnifier, the parameter is the center point, radius, grid, time

Ccripple3d: actionwithposition (ccpointmake (size. width/2, size. height/2), 240, 4,160, CCG (), T); // The water wave parameter is the center point, radius, number of waves, amplitude, grid, and time.

Ccliquid: actionwithwaves (4, 20, CCG (16, 12), T); // fluid effect, number of waves, amplitude, grid, time

Ccwaves: actionwithwaves (4, 20, true, true, CCG (16, 12), T); // distorted wave, number of waves, amplitude, horizontal sin, vertical sin, grid, time

Cctwirl: actionwithposition (ccpointmake (size. width/2, size. height/2), 1, 2.5f, CCG (12, 8), T); // twist, center, twist number, amplitude, grid, time

Ccshakytiles3d: actionwithrange (5, true, CCG (16, 12), T); // water wave, range, Z axis, grid, time

Ccshatteredtiles3d: actionwithrange (5, true, CCG (16, 12), T); // broken distortion, range, Z axis, grid, time

Ccshuffletiles: actionwithseed (25, CCG (16, 12), T); // scatter

Ccfadeouttrtiles: actionwithsize (CCG (), T); // top and right fades out

Ccfadeoutbltiles: actionwithsize (CCG (), T); // fade out from the left

Ccfadeoutuptiles: actionwithsize (CCG (16,12), T); // fade out upwards

Ccfadeoutdowntiles: actionwithsize (CCG (16,12), T); // fade down

Ccturnofftiles: actionwithseed (25, CCG (), T); // The square disappears

Ccwavestiles3d: actionwithwaves (4,120, CCG (), T); // Square Wave

Ccjumptiles3d: actionwithjumps (2, 30, CCG (15, 10), T); // jump Square

Ccsplitrows: actionwithrows (9, T); // cut rows

Ccsplitcols: actionwithcols (9, T); // cut the column

Ccpageturn3d: actionwithsize (CCG (15,10), T); // flip

I just started to study this engine. If there are any errors, I hope you can correct them more.

Next, let's take a look at other scenarios in the test class.

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.