Jump to content

Advance time in emitters


TomLGD
 Share

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?

 

thanks

Tom

post-16790-0-47557500-1444579873.png

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

https://github.com/photonstorm/phaser/blob/858ad5161028d45d65679c88fc1e9a08ceed1f8f/src/particles/arcade/Emitter.js

 

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

http://phaser.io/sandbox/edit/LlkfEvEx

 

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

https://github.com/photonstorm/phaser/search?utf8=%E2%9C%93&q=manualupdate

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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