Show emitter only on screen touch

Hi guys,

Can you please help me out with one issue.

I am playing with RoamingGamer Particle Emitter Editor.

So you load a constant emitter on screen like this:

local emitter = pex.loadRG( nil, 500, 200, “emitters/RG/emitterxxxx.rg”,

   { texturePath = “emitters/RG/”,

     altTexture = “picture.png” } )

  1. How to edit emitter width, height and color (I must use Emitter Creator tool?)?

  2. How to display emitter only on screen touch for a limited amount of time (for example 500 milliseconds)?

    So when player touches screen for example 5 times, 5 emitters are displayed on screen (on different xy positions - where player touched screen).

Many thanks!  :smiley:

Ivan 

Hi Ivan,

Basically, you need to create a new emitter object on each touch. Emitters are just display objects, as outlined here:

https://docs.coronalabs.com/api/library/display/newEmitter.html

Now, to make each one stop after 500 ms, you’ll need to start a timer when the emitter is created, because emitter objects do not have an “onComplete” type of event. When the timer finishes, simply stop the emitter and remove it from the display (obviously you don’t want to keep it there or it will occupy some memory).

As for editing size, colors, etc., you don’t necessarily need the Particle Designer application (which is not free, and is only available for Mac). All emitter properties are controlled by the JSON parameters, and most of them are fairly obvious in their purpose.

Brent

@ivan,

  1. Thanks for using my editor and library.  The editor is a bit dated, but I hope it still functions well enough to be worth the few dollars?

  2. The pex loader module that comes with my tool (pex editor) is designed to allow you to load these tools’ ouput format:

Particle Designer 2.0 (71 Squared) - PEX Loader watches for and fixes a few issues with this tool’s output (they may have fixed these in future release, making my loader redundant for this purpose.)

Particle Editor for Corona SDK (Roaming Gamer, LLC.) - PEX Loader loads my tool’s output of course.

Particle Editor (One By One Design) - PEX Loader corrects issues with this free tool’s output to make it work with Corona emitters.

(https://coronalabs.com/blog/2014/04/29/tutorial-corona-particle-tools-and-data-formats/)

  1. PEX Loader also allows you to specify a parameters table that is used to modify the loaded JSON file before using it to make an emitter.  You should look at my loader code and consider expanding upon these parameter changes to allow you to change the emitter size and other parameters at instantiation time.

Cheers,

Ed

I checked my docs and you need to read page 7 of the PexTools.pdf file to learn about changing individual parameters:

pexloader.png

PS - It is worth noting, the docs say 3500ms, but should have read 3000 ms since:

duration = 3.0 -- is 3000 ms

Thank you Brent!
Thank you RoamingGamer!

Roaming gamer, I have changed few parameters, and your emitter libraries are fantastic!
I will dispose them like normal display objects.
I will mention your website on my new game Credits page, I have a feeling game will rock :slight_smile:
Coming up soon! :slight_smile:

Thank you.
Ivan

Hi Ivan,

Basically, you need to create a new emitter object on each touch. Emitters are just display objects, as outlined here:

https://docs.coronalabs.com/api/library/display/newEmitter.html

Now, to make each one stop after 500 ms, you’ll need to start a timer when the emitter is created, because emitter objects do not have an “onComplete” type of event. When the timer finishes, simply stop the emitter and remove it from the display (obviously you don’t want to keep it there or it will occupy some memory).

As for editing size, colors, etc., you don’t necessarily need the Particle Designer application (which is not free, and is only available for Mac). All emitter properties are controlled by the JSON parameters, and most of them are fairly obvious in their purpose.

Brent

@ivan,

  1. Thanks for using my editor and library.  The editor is a bit dated, but I hope it still functions well enough to be worth the few dollars?

  2. The pex loader module that comes with my tool (pex editor) is designed to allow you to load these tools’ ouput format:

Particle Designer 2.0 (71 Squared) - PEX Loader watches for and fixes a few issues with this tool’s output (they may have fixed these in future release, making my loader redundant for this purpose.)

Particle Editor for Corona SDK (Roaming Gamer, LLC.) - PEX Loader loads my tool’s output of course.

Particle Editor (One By One Design) - PEX Loader corrects issues with this free tool’s output to make it work with Corona emitters.

(https://coronalabs.com/blog/2014/04/29/tutorial-corona-particle-tools-and-data-formats/)

  1. PEX Loader also allows you to specify a parameters table that is used to modify the loaded JSON file before using it to make an emitter.  You should look at my loader code and consider expanding upon these parameter changes to allow you to change the emitter size and other parameters at instantiation time.

Cheers,

Ed

I checked my docs and you need to read page 7 of the PexTools.pdf file to learn about changing individual parameters:

pexloader.png

PS - It is worth noting, the docs say 3500ms, but should have read 3000 ms since:

duration = 3.0 -- is 3000 ms

Thank you Brent!
Thank you RoamingGamer!

Roaming gamer, I have changed few parameters, and your emitter libraries are fantastic!
I will dispose them like normal display objects.
I will mention your website on my new game Credits page, I have a feeling game will rock :slight_smile:
Coming up soon! :slight_smile:

Thank you.
Ivan