Hi, I have almost tried everything. How can I make every particle in emitter has any random scale?
this.scene.add.particles("particles").createEmitter({
x: { min: 0, max: this.scene.game.GW },
y: this.scene.game.GH + 100,
angle: { min: 0, max: 360 },
scale: {min:0.1,max:0.9},
frame: { frames: ["cube_1", "cube_2", "cube_3", "cube_4"] },
alpha: 0.3,
deathZone: {
type: "onEnter",
source: new Phaser.Geom.Rectangle(0, -50, this.scene.game.GW, 50),
},
lifespan: 10000, // { min, max }, or { min, max, steps }
speedY: { min: -200, max: -300 },
frequency: 1500,
reserve: 10,
delay: 2500,
})
With min,max particles are just getting bigger. I want constant scale.
I have also tried
emitter.onParticleEmit(particle=>particle.scaleX = some scale...,this)
scaleX property changes but size on the screen is the same.
Can anybody help?
thanks
samme
December 3, 2020, 5:04pm
3
1 Like
Thanks, but in my case it is being tweened. I searched the source code of emitter and found
// BUG: alpha, rotate, scaleX, scaleY, or tint are eased here if {min, max} is given.
// Probably this branch should exclude isRandom entirely.*
I think i have old Phaser library version
I have the latest version. So how can I repair this bug?
samme
December 3, 2020, 5:47pm
6
It should work correctly in v3.24.1, like the example. Double-check the version in your browser console.
Phaser v3.24.1-FB (Canvas | Web Audio)
samme
December 3, 2020, 6:02pm
8
Try only
this.scene.add.particles('particles').createEmitter({
x: { min: 0, max: 1000 },
y: { min: 0, max: 1000 },
scale: { min: 0.1, max: 0.9 },
frame: { frames: ['cube_1', 'cube_2', 'cube_3', 'cube_4'] }
});
To be sure, I did the npm i phaser again.
Your code creates a “fluctuation” effect, everything is easing
Oddly enough, I will add that when it was
x: {min: 0, max: this.scene.game.GW}, y: this.scene.game.GH + 100,
the particles were not easing on the X axis, and with your code, they do
So what can I do? I thought about setting lifespan for maximum value and set death zone so the scale tweening will be minimal and particles will die in deathzone
samme
December 4, 2020, 6:51pm
12
I was wrong, it’s not fixed in v3.24.1.
You can do
// Workaround for <https://github.com/photonstorm/phaser/issues/3608>
// Phaser <= v3.24.1
emitter.scaleX.onUpdate = emitter.scaleX.defaultUpdate;
1 Like