A few days ago is lazy, day classes, and then come back at night almost can not get anything on the sleep, so did not send anything, today finally play the spirit continue to study. We said today that ccaction includes, Ccaction,ccfinitetimeaction,ccspeed,ccfollow,
Here we go:
First Ccaction is divided into three categories, namely Ccfinitetimeaction,ccspeed, and Ccfollow
Ccfinitetimeaction is divided into two categories, the ccaction should be written ccfinitetimeaction,
Ccfinitetimeaction including ccactioninstant (instantaneous action), Ccactioninterval (Delay action)
The instantaneous action also includes above several, these movements are in the instant completes, we cannot see the transformation the process, should for him too fast. You may ask Ccplace and setposition not all the same, why superfluous to use ccplace also packaged into an action, in fact, these can be encapsulated into a sequence, this is not the difference between ccplace and setposition it.
code example:
Ccflipy *flipx = Ccflipy::create (true); Cchide *hide = Cchide::create (); Cctogglevisibility *togglevis = Cctogglevisibility::create (); Ccplace *place = Ccplace::create (CCP (200, 200));
Simple usage
The above several relatively difficult to understand is the false action Cccallfunc, so we specifically say this. False action is no action, in fact, he is just a callback.
<span style= "FONT-SIZE:24PX;" >cccallfunc *callfun = Cccallfunc::create (This, Callfunc_selector (T14ccactiondemo::funcall)); CCCALLFUNCN *callfunc = Cccallfuncn::create (This, Callfuncn_selector (T14ccactiondemo::funcalln)); CCCALLFUNCND *CALLFUNCND = Cccallfuncnd::create (This, Callfuncnd_selector (T14CCACTIONDEMO::FUNCALLND), (void *) ("90" )); Cccallfunco *callfunco = Cccallfunco::create (This, Callfunco_selector (T14ccactiondemo::funcallo), woman); </span >
void T14ccactiondemo::funcall () {Cclog ("action is OK");} void T14ccactiondemo::funcalln (ccnode* node) {node->setvisible (false);} void T14ccactiondemo::funcallnd (ccnode* pnode, void* pdata) {ccstring *str = Ccstring::createwithformat ("%s", pdata); Pnode->setrotation (Str->floatvalue ());} void T14ccactiondemo::funcallo (ccobject* obj) {ccsprite *woman = (ccsprite *) obj; Ccmoveby *moveby = ccmoveby::create (2, CCP (0)); woman->runaction (Moveby);}
We can put some of the false action of the column into the ccsequence inside, we can not pass the false action to determine which action to execute it? For example, there are 3 in a ccsequence, Moveby,jumpby,cccallfunc, this time to execute to the Cccallfunc callback when the time does not mean that the first two actions are done. There's a lot more to this scenario,
Cccallfunc is a most basic fake action, CCCALLFUNCN can be in the callback when the CCNODE,CCCALLFUNCND can be ccnode at the time of the callback, and Data,data is the data we manually added, the above example is that " 90 "of the string ah. Cccallfunco can get the ccobject that we define when it falls off.
All of this is a time-lapse action, with the sample code attached:
Ccmoveto *moveto = ccmoveto::create (3, CCP (300, 100)); Ccmoveby *moveby = ccmoveby::create (2, CCP (200, 0)); Ccmoveby *moveby2 = ccmoveby::create (2, CCP (200, 0)); Ccjumpto *jumpto = ccjumpto::create (3, CCP (300,100), 50, 3); Ccjumpby *jumpby = ccjumpby::create (3, CCP (200, 0), 150, 3); Ccscaleto *scaleto = Ccscaleto::create (3, 2); Ccscaleby *scaleby = Ccscaleby::create (3, 2); Ccrotateto *rotateto = ccrotateto::create (3,-90); Ccrotateby *rotateby = ccrotateby::create (3,-90); Ccspawn *spawn = ccspawn::create (Rotateto, scaleby,null); Ccsequence *sequence = ccsequence::create (Rotateto, Scaleby, NULL); Ccskewto *skewto = ccskewto::create (3, 222, 222); Cctintto *tintto = cctintto::create (3, 255, 0, 255); Ccfadein *fadein = ccfadein::create (3); Ccfadeout *fadeout = ccfadeout::create (3); Ccfadeto *fadeto = ccfadeto::create (3, 100); Ccpointarray *pointarray = ccpointarray::create (6);p Ointarray->addcontrolpoint (CCP);p ointarray-> Addcontrolpoint (CCP);p Ointarray->addcontrolpoint (CCP (200), (+));p Ointarray->addcontrolpoint (CCP);p Ointarray->addcontrolpoint (CCP);p ointarray- >addcontrolpoint (CCP (450, 160)); Cccardinalsplineto *cardinal = Cccardinalsplineto::create (Ten, Pointarray, 1); Ccblink *blink = Ccblink::create (3, 5); Cceaseexponentialin *exponentin = cceaseexponentialin::create (Moveby); Cceasebackin *bakcin = cceasebackin::create (Moveby);
Method A lot of many, specific can look at the API, really do not understand can be based on the above example of the API, about some buffers can do their own experiments, here I say also do not top your own practice.
Finally, there are ccspeed and ccfollow,ccspeed are mainly variable speed:
Ccspeed *speed = Ccspeed::create (Moveby, 5);//increase speed by 5 times times
Words Ccfollow I also dabbler, dare not utter, oneself only made an experiment, today will get here
All right, bloggers have to go to bed early, they have to sleep before 11 o ' night.
2015-04-04---ccaction detailed (owed to everyone for several days)