Cocos2d-x Getting Started (5) Ccaction: Action

Source: Internet
Author: User

Instantaneous action

Instantaneous action does not take time, complete immediately

Placed, =setposition ()  
prole->runaction (Ccplace::create (CCP (300,300)));  
      
Hidden, =setvisible (false)  
prole->runaction (Cchide::create ());  
      
Display, =setvisible (true)  
prole->runaction (Ccshow::create ());  
      
Flip horizontally, =setflipx (true)  
prole->runaction (Ccflipx::create (true));  
      
Flip vertically, =setflipy (true)  
prole->runaction (Ccflipy::create (true));

Delay action

move to, 1s,  
prole->runaction (Ccmoveto::create (1,CCP (300,300)));  
      
jump to, 1s, height 50, divided into 5 steps  
prole->runaction (Ccjumpto::create (1,CCP (300,300), 50,5));  
      
Enlarge to, 1s,2 times size  
prole->runaction (ccscaleto::create (1,2));  
      
Rotate to, 1s,90 degree  
prole->runaction (ccrotateto::create (1,90));  
      
Flashing, 1s,5 under  
prole->runaction (ccblink::create (1,5));  
      
Tonal changes to 1s,rgb  
prole->runaction (cctintto::create (1,100,100,100));  
      
dimming to 1s, transparency  
prole->runaction (Ccfadeto::create (1,50));  
      
by no brightening, 1s,  
prole->runaction (ccfadein::create (1));  
      
From bright to No, 1s,  
prole->runaction (ccfadeout::create (1));  
      
Horizontal flip, 1s  
prole->runaction (ccflipx3d::create (1));

Repeat action

Repeated execution  
of Prole->runaction (Ccrepeat::create (ccflipx3d::create (1), 2));  
      
Infinite repetition  
prole->runaction (Ccrepeatforever::create (ccflipx3d::create (1)));

Reverse action

Reverse actions, usually only Ccxxxby support  
prole->runaction (Ccsequence::create (1,CCP (50,50)), ccmoveby::create (1,CCP (50,50))->reverse (), NULL));

Continuous action

Continuous action  
ccflipx3d* flip3d=ccflipx3d::create (1);  
ccblink* blink=ccblink::create (1,2);  
ccscaleto* scaleto=ccscaleto::create (1,2);  
Prole->runaction (Ccsequence::create (Flip3d,blink, scaleto,null));

Sync action

Synchronous action to ensure that the action can be performed synchronously,  
ccrotateto* roteto=ccrotateto::create (1,90);  
ccfadeto* fadeto=ccfadeto::create (1,50);  
Prole->runaction (Ccspawn::create (Roteto,fadeto, NULL));

The difference between Ccmoveby and Ccmoveto:

Ccmoveby: is a vector, starting at the current point and the size of the parameter point is the position after the move

Ccmoveto: Is the end value, set which point, move to where, regardless of where it started.

Source: Http://blog.csdn.net/Vestigge

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.