Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Particles spawn too fast - Phaser 3

I am trying to make a snow effect behind the main menu of my game using the particle emitter but particles spawn way too fast.

I have this code:

       var particles = this.add.particles('snow');

        var emitter = particles.createEmitter({
            speedY: { min: 15, max: 40 },
            gravityY: 0,
            scale: 0.2,
            quantity: 1,
            lifespan: { min: 28000, max: 30000 },
            emitZone: { source: new Phaser.Geom.Line(-20, -100, 820, -100 )}
       });

And quantity is only one, so I do not know how to fix this. Is it possible to change the spawn speed of the particles?

I am using Phaser 3 and the arcade physics.

like image 361
Ridertvis Avatar asked Jun 07 '26 10:06

Ridertvis


1 Answers

I think what you're looking for is the frequency setting.

It doesn't exactly change the spawn speed, but it changes the time between flow cycles. If you add a frequency: 1000 to the emitter you currently have, it gives you about 8-10 particles on the screen at a time. You can play with that number until you get the flow you want.

like image 146
brae Avatar answered Jun 10 '26 17:06

brae



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!