gabenix Posted May 30, 2014 Share Posted May 30, 2014 Hello All, Is it possible to access and change the properties of individual particles released from an emitter? (without requiring an overlap detection) Let's say I've emitted 3 particles from an emitter... Is there a way to retrieve the properties of each particle (x,y,velocity,rotation, etc) then execute code that will be applied to that single particle if it meets certain criteria? I've been using emitters to create enemies, projectiles, and scene objects. Many times there are multiple on the screen at one time and they need to be accessed and respond individually. A scenario that I've came across is the combination of particles from different emitters that must work together. For example, you have an "enemy" particle, that will shoot a a "fireball" particle from the "enemy" particles current location... then the "fireball" particle will be followed by an emitter to create a smoke trail of particles as the "fireball" particle travels. I've come up with a work around by placing a physics.body that is the full size of the screen and then checking with "game.physics.arcade.overlap". Since any particle will always be overlapping with it, I can execute code on that particle. BUT.. this still only works if there is only one particle of a certain type. It doesnt give me access to indivual particles. Are particles assigned unique identifiers, and can they be accessed so each particle can be controlled individually without requiring overlap/collision detection? Link to comment Share on other sites More sharing options...
XekeDeath Posted May 30, 2014 Share Posted May 30, 2014 An emitter is just a fancy Phaser.Group, so you have access to the forEach/forEachAlive functions of groups to iterate over all the particles and see if they match your conditions. Link to comment Share on other sites More sharing options...
Recommended Posts