Particle editor Option 1

Source: Internet
Author: User

It seems that there is no choice, the current Windows found a particle Editor, called cocos2d-windows-particle-editor.

This is an open-source project. You can obtain it from the URL below.
Http://code.google.com/p/cocos2d-windows-particle-editor/

Editor attributes

Particles and transmitters are an indispensable part of the particle system. The transmitter emits a large number of particles according to certain rules to form the desired effect. This effect is affected by the emission method and particle attributes. Therefore, you must have a certain understanding of them and use them easily.

The following describes some attributes based on actual needs.

1. Mode

There are two types of existing Transmitters: gravity (gravity) and radius (RADIUS.

The type of the transmitter determines how it works. Different types of transmitters determine how the particles emitted by the emitter based on different attributes. Mode is one of the most important basic attributes of a transmitter.

2. totalparticipant

This attribute determines the maximum number of particles that can survive at the same time. This is a peak value, mainly used to limit the consumption of memory and other resources.

3. emissionrate

The particle emission rate, that is, the number of particles emitted per second.

Here is a problem. I don't know if it is a bug. I 'd like to describe it to you:

Ccparticlesystem does not read the value of emissionrate when loading the. plist file. In fact, it is calculated by dividing the maximum number of particles by the particle life cycle.

1 //Emission Rate2M_femissionrate = m_utotalparticipant/m_flife;

A little hard to say, right. Why should I send all the particles out during the lifetime of the first particle?

This is a problem for ccparticlesystem to load the. plist file. The temporary solution is to manually call setemissionrate to set the number of launches per second after the. plist file is loaded.

Although it is a bit too long, it is much easier to set the attributes of the particle system manually.

4. Duration

Duration indicates the time when the transmitter is executed, in seconds. If it is set to-1, it indicates that the transmitter continuously emits particles. Zero is a valid value, but setting it to zero makes no sense, doesn't it?

5. isautoremoveonfinish

Whether to delete the particle system after the emission is completed. The default value is false.

A known bug exists here:

When isautoremoveonfinish is true and duration is not-1, after the particle effect is played, the particle system will automatically delete it, causing the editor to be unavailable.

Temporary solution

Close the editor and open it again.

6. positiontype

Positiontype has three values:
(1) Free (free)
Particles are attached to the game world and are not affected by the displacement of transmitters.
(2) Relative (relative)
Particles are attached to the game world, but must follow the transmitters.
(3) grouped)
The particle is attached to the transmitter and changes with the change of the transmitter.

7. sourcepositionx, sourcepositiony

These two values indicate the original coordinates of the transmitter.

8. posvarx, posvary

The floating value of the transmitter coordinate.

9. Angle

Particle emission angle.

10. anglevar

The floating value of the particle emission angle.

11. Speed

Particle (initial) speed.

12. speedvar

Particle (initial) Speed Floating value.

13. gravityx, gravityy

The acceleration of particles on the X and Y axes.

14. radialaccel

Radial Acceleration of particles.

15. radialaccelvar

The Radial Acceleration floating value of the particle.

16. tangentialaccel

The tangent acceleration of the particle.

17. tangentialaccelvar

The floating value of the tangent acceleration of the particle.

18. startradius

Initial radius

19. startradiusvar

Initial radius floating Value

20. endradius

End radius

21. endradiusvar

Floating End radius

22. rotatepersecond

Angular Velocity of the particle's rotation around the initial point

23. rotatepersecondper

The floating value of the particle's rotation speed around the initial point.

The above is about the attributes of the transmitter. Let's take a look at the attributes of the particle itself.

24. Life, lifevar

The lifetime and floating value of the particle. Starting from particle creation, the particle disappears once the lifetime is exceeded.

25. startsize

Initial Particle Size

26. startsizevar

Floating value of the initial Particle Size

27. endsize

The ending size of the particle. If the value is-1, the end size is the same as the initial size.

28. endsizevar

Floating value of the particle end size.

29. startcolor, endcolor, startcolorvar, and endcolorvar indicate the initial color, ending color, and floating value of the particle.

Note that in cccolor4f, each color component and transparency are represented by 0.0f to 1.0f, And the editor uses 0 to 255, so sometimes it may produce small errors. (I have learned only a little about OpenGL before, and I don't quite understand how to deal with the color components of the converted non-integer in OpenGL .)

30. texturepath

The path of the texture map. The engine determines the file to be loaded Based on the path of the. plist file and this attribute. Generally, the relative path is required.

31. srcblendfunc, destblendfunc

There are many options for setting texture fusion. In view of the author's OpenGL level, we will not go into depth here.

In general, you only need to remember: "The cc_blend_src and cc_blend_dst that we use most often correspond to gl_one and gl_one_minus_src_alpha respectively ".

32. isblendadditive

For the moment, ignore the attribute isblendadditive, which was not read by cocos2d-x engine Reagan.

33. startspin, endspin, startspinvar, endspinvar

The initial spin angle, ending spin angle, and floating value of a particle. With these values set, the particle starts to rotate. Of course, you need a proper texture to see clearly.

34. isbackgroundmove

Set whether the background of the preview screen on the left is moved.

35. Scale

Set the zoom ratio of the preview screen on the left. The image on the left is actually displayed twice. The original size is set to 0.5 on the left.

Note: The above two attributesOnly the preview effect in the editor is affected, but not the saved. plist file..

Use of the Editor

After opening the editor, select the required basic configuration from the sample menu, set the specific properties, and save it as a. plist file for the game.

Loading the. plist file in a cocos2d-x is simple. Assume that the smoke effects of enemy shells in chapter 7 of Zhiyi are saved in the emitter. plist file, and the flame effects of gamer shells are saved in the emitter2.plist file.CodeAs follows:

 1   Void Bulletsprite: bulletinit ( Void  )  2   {  3 Emitter = New  Cocos2d: ccparticlesystemquad (); 4 Emitter-> initwithfile ( "  Emitter. plist  "  );  5       //  Why do you need to add the following sentence? For details, refer to attribute introduction 3rd.  6 Emitter-> setemissionrate ( 75.0f  );  7 Emitter-> Stopsystem ();  8   Addchild (emitter ); 9   10 Emitter2 = New  Cocos2d: ccparticlesystemquad ();  11 Emitter2-> initwithfile ( "  Emitter2.plist  "  );  12 Emitter2-> setemissionrate ( 3500000f  );  13 Emitter2-> Stopsystem (); 14   Addchild (emitter2 );  15 }

Well, it's not that difficult to think about today, isn't it?

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.