Cocos2d-x for WP genie action-Actions

Source: Internet
Author: User

 

Ccfinitetimeaction: The execution class of a limited action, that is, to execute a series of actions in chronological order. After the execution, the action ends. Here we will learn this class.

We can see that the action is mainly divided into two categories: ccactioninstanse (base class of instantaneous action) and ccactioninterval (base class of delayed action)

Ccactioninstanse (the base class of the instantaneous action ):

Cccallfunc: execution function ccflipx/Y: x/y flip cchide: Hide

Ccplace: Set the location ccreusegrid: Reuse grid ccshow: Display

Ccstopgrid: Stop grid cctogglevisibility: visible Switch

Ccactioninterval (the base class of the delayed action) is the most commonly used delayed action. There are many subclasses of ccactioninterval, which can be learned through the tests example that comes with the cocos2d-x.

The main actions are as follows:

Ccmoveto/ccmoveby: Move ccscaleto/ccscaleby: Zoom ccrotateto/ccrotateby: Rotate

Ccskewto/ccskewby: Twisted ccjumpto/ccjumpby: Jump ccbezierto/ccbezierby: besell Curve

Ccbink: Blinking ccfadein/ccfadeout: fade in and fade out cctintto/cctintby: Dye

Ccspawn: Synchronous ccrepeat/ccrepeatforever: yes/no repetition

Ccdelaytime: latency

The following is an example: grossini is a genie

CCActionInterval actionBy = CCJumpBy.actionWithDuration(2, new CCPoint(100, 100), 50, 4);CCFiniteTimeAction actionByBack = actionBy.reverse();grossini.runAction(CCSequence.actions(actionBy, actionByBack));

 

In general, we can write in this way, and combine several actions together to realize the actions of the genie.

CCAction action = CCSequence.actions(CCSpawn.actions(CCAnimate.actionWithAnimation(animation, false),CCMoveBy.actionWithDuration(0.28f, position),CCCallFuncND.actionWithTarget(this, onWalkDone, tag)));grossini.runAction(action);

Ccsequence is an action sequence. It combines several actions in sequence and then executes them in sequence.

Ccspawn combines several actions and executes them simultaneously (in parallel). The execution time is subject to the longest action.

The parameter is an action array of ccfinitetimeaction [] actions, such as ccmoveby, ccskewby, and ccscaleby. In general, put a cccallfunc In the last action of ccspawn, and put a callback function (ondomaindone) as the processing after the action is executed (for example, display information and character orientation ).

 

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.