Cocos2dx meteor effect implementation, cocos2dx meteor implementation

Source: Internet
Author: User

Cocos2dx meteor effect implementation, cocos2dx meteor implementation

DionysosLai (906391500@qq.com)

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!
How can cocos2dx bring the camera closer?

Zoom genie. Cocos2dx does not seem to be able to be adjusted by camera like Unity3D.

Cocos2dx and cocos2d game development which is better?

So don't think about it, it must be cocos2dx, because cocos2d can only develop ios games, can not be transplanted to android, because cocos2d is OC language, cocos2d-x is not the same, it is written in c ++ and can be well implemented across platforms. The advantages of these two items are the same. You can achieve good animation effects without using OpenGL code, and it is easy to learn. forums and blogs in this area are everywhere, you can use it with confidence. Disadvantages I think that if I want to implement cross-platform requests, I need to work harder on network requests. In the past, I spent some time doing this. cross-platform network request libraries are hard to find, previously Used cURL. You can try it. Cocos2dx is a tool for cocos2d porting. The functions in cocos2dx are similar, but cocos2dx is written in c ++ and cocos2d is written in OC. Therefore, the code format remains quite different. The operation interface is the same. There are basic concepts such as directors, scenes, layers, and genie. Therefore, it is a principle. As long as these concepts are passed, others are the writing issues.

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.