Jump to content

Advance time in emitters


Recommended Posts

Hi guys,


for my game i use a emitter (game.add.emitter) for a snowing weather effect.


When i start the state the emitter starts as well.


So it looks like it has just started to snow right at the moment the player starts the game.


Is it possible to advance the emitter progress. So it looks like the emitter does its work

for a while?





Link to comment
Share on other sites

Here is my Emitter Code:

addSnowflakes: function(name) {	if (isMobile) return;	var emitter = game.add.emitter(game.world.centerX, -32, 600);    	emitter.makeParticles("atlas", ["snowflake", "snowflakebig"]);	emitter.maxParticleScale = 1;	emitter.minParticleScale = 1;	emitter.setXSpeed(-10, 10);	emitter.setXSpeed(2, 10);	emitter.gravity = 0;	emitter.width = game.world.width * 1.5;	emitter.minRotation = 0;	emitter.maxRotation = 0;	emitter.start(false, 4000, 1);},

I don't know how this helps cause its a general question about emitters^^

Link to comment
Share on other sites

I can't see a way to do it in the code



possibly you could speed up your game for a bit before showing it.. but that's going to cause a whole load of unknown side effects

game.time.slowMotion = 0.001

i tried fiddling with it here



might be worth making a request for phaser 3.. regarding just being able to set the game physics time temporarily to calculate projected movement etc as well

Link to comment
Share on other sites

One solution would be so "transfer" the emitter.

Cause i will restart the state  every time the user wants to play again.

So the emitter is always reset and restarted.

Is it possible to hold the current emitter state for reusing?

Link to comment
Share on other sites

this is what Rich said

onEmit is called the moment they are ​_born_​, so can definitely be used to alter immediate propertieshowever what I'd likely do is just set the Emitter to manualUpdate and then step through it as many times as you needthen put it back under plugin control

I think that latter part may just be for Particle Storm, as I don't see that option in Phaser code


Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...