Cocos2d-js particle system uses custom images to restore the original image width and height

Source: Internet
Author: User

Particle systems using a custom picture is simple enough to set the PNG name on the last line of plist. However, in the actual use, found that the custom image can not use the original shape, for example, set a long picture, the result is really a ball.

Turned the plist and CC. Particlesystem definition, no custom shape properties found, for the moment cocos2d can not use the original shape of the custom picture, the default display will be compressed into a square diagram, a long picture is compressed. (If an expert has an accurate statement, please leave a message to tell me)

But we can get around this problem by simple tricks.

To restore the original effect, you can use Setscalex/setscaley to control the size of the graph after initialization.

It's actually stretching the entire particle system, but that's exactly what we need.

such as the wind effect below. If you do not set ScaleX, the effect is a piece of white ball.

Cocos2d-js particle system uses custom images to restore the original image width and height

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.