Cocos2d-X genie, Action Effects

Source: Internet
Author: User

Namespace macro:
USING_NS_CC.
NS_CC_BEGIN; = using namespace cocos2d {
NS_CC_END ;}

--------------------------------------------------------------------------------

Judge whether an genie is clicked:
1. The layer needs to receive click messages. 2. Obtain the click coordinate in the callback function. 3. Use the boudingBox (). containsPoint function to judge the result. (Or use the convertTouchToNodeSpaceAR method)

--------------------------------------------------------------------------------

Multi-Layer click processing:
1. Use ccTouchesBegan (). This function returns true, indicating that the message chain is interrupted. messages are received at the current layer. If false is returned, messages are not received at the current layer.
2. rewrite a Layer. The general idea is that only the bottom Layer receives messages and forwards them to each Layer in a certain way.
--------------------------------------------------------------------------------

Genie stretch:
SetScale () tries not to use this transformation because it will be virtual.

--------------------------------------------------------------------------------

Genie Translucent:
SetOpacity () is used to set translucent 0 ~ 255.

--------------------------------------------------------------------------------

Sprite rotation:
SetRotation () is a Z axis rotation by default.
The setRotationX () x axis is the axis of symmetry rotation.
SetRotationY () Y axis is symmetric center.

--------------------------------------------------------------------------------

Set the color of the genie:
SetColor () is useless. There are macros such as ccBLUE.

--------------------------------------------------------------------------------

The opposite action:
Reverse () creates an inverse action. The previous action must be of the By type. It is independent of coordinates and only related to actions.
The opposite series of actions:
Assign a series of actions created by CCSquence to a CCFiniteTimeAction pointer, and then call the reverse of the pointer.

--------------------------------------------------------------------------------

Action type:
CCActionInterval:
Class Name Function
CCMoveTo mobile
CCScaleTo Amplification
CCSKewTo skew (infinite distance rotation)
CCRotateTo Rotation
CCJumpTo beat
CCBezierTo besell curve movement
CCBlink flashing
CCFadeIn \ Out fading
CCTintTo coloring
CCToggleVisibility switchover visibility
CCHide hide
CCShow display
CCOrbitCamera orbital camera? Able to achieve the effect of leaf flip
CCCardinalSplineBy Path movement
CCCatmullRomTo is also a Path movement. I don't know what the difference is.


--------------------------------------------------------------------------------

Repeated actions:
CCRepeatForever: create () in runaAtion, set the corresponding action to this type.

--------------------------------------------------------------------------------

Repeated action:
CCRepeat: create () in runaAtion, set the corresponding action to this type.

--------------------------------------------------------------------------------

Synchronization:
The usage of CCSpawn is the same as that of CCSquence, but it is executed simultaneously.

--------------------------------------------------------------------------------

Follow the Wizard to move:
The runAction in the CCFollow running Layer. The second parameter is the Layer size.

--------------------------------------------------------------------------------

Action sequences of multiple genie:
CCTargetedAction is a Sprite-related action. After being created, it can be directly stored in CCSqence.

--------------------------------------------------------------------------------

Action superposition:
Multiple runactions can be called by the genie to overlay different actions.

--------------------------------------------------------------------------------

Pause and resume an action:
Pause action:
SharedDirector-> getActionManager ()-> pauseAllRunningActions () can suspend all actions. The returned value is a CCSet * which needs to be saved to m_pPausedTargets. For more information, see:
CC_SAFE_RELEASE (m_pPausedTargets );
M_pPausedTargets = director-> getActionManager ()-> pauseAllRunningActions ();
CC_SAFE_RETAIN (m_pPausedTargets );
Action Recovery:
SharedDirector-> getActionManager ()-> resumeTargets (m_pPausedTargets)

--------------------------------------------------------------------------------


 

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.