Dionysoslai ([email protected]) 2014/8/28
It is not the best choice for a meteor that is used to set off a beautiful artistic conception and that is a few moments in the sky. For those who are infatuated with love, they will be in the beautiful scenery of this moment. Today, I am waiting for rough people to "spoil" this beautiful thing.
Functional requirements:
1. Achieve the meteor effect. The effect is the same as that achieved:
Function Analysis:
1. image analysis can be simplified as follows:
Unchanged part: meteor head;
Tail part: the tail of a meteor. Note that the tail of a meteor is rough and sharp. At the same time, the color changes from start to end. The variation varies depending on the position.
Particle part: in the meteor tail area, you can use a few small stars.
Therefore, the production of a meteor is:Genie movement + tail effect + fine-grained Little Star particle effect.
Function implementation:
The key part is the preparation of the meteor tail part, which is placed on the Particle effect of the small star, that is, it is slowly adjusted by yourself.
Achieve meteor tail:
The ccmotionstreak class that comes with cocos2dx is used here. For ccmotionstreak applications, you can refer to the built-in test example of the engine.
The core code is as follows:
m_pMoStar = CCMotionStreak::create(0.5f, 1, 7, ccWHITE,"page9/steak.png" );m_pMoStar->setPosition(CCPointZero);m_pMoStar->setVisible(false);addChild(m_pMoStar);
Then, update the location of the Instance continuously.
Some of the preceding values are based on the image. The image is dragged to the end as follows:
There is a way out of the picture here, which was originally used to cut the light effect in the fruit game. In actual use, the image should be thick and thin, and its tail has other colors.
For detailed code and resource path, visit here: https://github.com/DionysosLai/cocoEffect/tree/master/%E6%B5%81%E6%98%9F.
Tomorrow's Mid-Autumn Festival, I wish you a happy holiday!
Cocos2dx meteor effect implementation