OriginalArticle, Reprint please indicate the source: http://blog.csdn.net/zhy_cheng/article/details/8278012
The implementation principle is to put two pictures, one bright and the other dark, put the dark picture under the bright picture, and then let the bright picture achieve the animation effect.
The suffocating blade of the phantom assassin allows the enemy unit to slow down and be hurt for 8 seconds.
I am very keen on phantom thorns.
Next let's take a lookCodeImplementation:
Ccsprite * S2 = ccsprite: Create ("pa2.png"); // pa2.png is a darker image S2-> setposition (CCP (200,200); addchild (S2, 0 ); ccsprite * s = ccsprite: Create ("pa1.png"); // pa1.png is a bright image ccprogresstimer * PT = ccprogresstite: progresswithsprite (s ); pt-> setposition (CCP (200,200); // implement Pt-> settype (cocos2d: ccprogresstimertype (kccprogresstimertyperadial) in the circle CD )); // appears from the middle to the outside // Pt-> settype (cocos2d: ccprogresstimertype (kccprogresstimertypebar); this-> addchild (PT, 1); ccprogressto * t = ccprogressto:: Action withduration (8,100); Pt-> runaction (ccrepeatforever: actionwithaction (t ));
There are comments in the code, so I won't say much.
Below is: