CCMoveTo CCMoveBy and CCscaleTo CCBlink in Cocos2D-x Game Development

Source: Internet
Author: User

After two or three days of rest, do you feel that I have no perseverance... Let's continue today.

Today, let's take a look at the four CCMoveTo CCMoveBy CCscaleTo CCBlink classes. It's easy to see the code.

Bool HelloWorld: init ()
{
Bool bRet = false;
Do
{
CC_BREAK_IF (! CCLayer: init ());
CCMenuItemImage * pCloseItem = CCMenuItemImage: create (
"CloseNormal.png ",
"CloseSelected.png ",
This,
Menu_selector (HelloWorld: menuCloseCallback ));
CC_BREAK_IF (! PCloseItem );


// Place the menu item bottom-right conner.
PCloseItem-> setPosition (ccp (CCDirector: shareddire()-> getWinSize (). width-20, 20 ));


// Create a menu with the "close" menu item, it's an auto release object.
CCMenu * pMenu = CCMenu: create (pCloseItem, NULL );
PMenu-> setPosition (CCPointZero );
CC_BREAK_IF (! PMenu );


// Add the menu to HelloWorld layer as a child layer.
This-> addChild (pMenu, 1 );
CCSprite * sprite = CCSprite: create ("sprite.png ");
CCSize size = CCDirector: shareddire()-> getWinSize ();
Sprite-> setPosition (ccp (size. width/2, size. height/2 ));
This-> addChild (sprite );
CCMoveTo * action = CCMoveTo: create (3.0f, ccp (size. width, size. height/2 ));
Sprite-> runAction (action );


CCSprite * sprite1 = CCSprite: create ("sprite.png ");
Sprite1-> setPosition (ccp (0, 0 ));
This-> addChild (sprite1 );
CCMoveBy * action1 = CCMoveBy: create (10.0f, ccp (size. width, size. height ));
Sprite1-> runAction (action1 );


CCScaleTo * scale = CCScaleTo: create (6.0f, 1.0f, 5.0f );
Sprite1-> runAction (scale );
CCBlink * blink = CCBlink: create (6.0f, 50 );
Sprite1-> runAction (blink );
BRet = true;
} While (0 );


Return bRet;
}

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.