Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Particles - startFollow causes x/y step particle emitters to not emit in steps (all emit from single coordinate) #5847

Closed
sreadixl opened this issue Sep 30, 2021 · 3 comments

Comments

@sreadixl
Copy link

Version

  • Phaser Version: 3.55.2, worked in 3.20.0
  • Operating system: Windows/Mac/iOS/Android/Kindle
  • Browser: All/Any

Description

If you create a particle emitter with x/y values that are EmitterOpSteppedConfig (start/end/steps) objects, then have the Particle Emitter follow another object using startFollow, instead of the particles emitting in steps, all the particles will emit from a single point.

Example Test Code

The following code will replicate the issue:

let follow = this.add.rectangle(0, 100, 400, 20, 0xff0000);
this.add.tween({targets:follow, duration: 10000, props:{x: this.scale.width}, yoyo:true, repeat:-1})
var stepConfig = {
    x: {start:0, end:this.scale.width, steps:6},
    y: 100,
    speedY: 100,
    speedX: Math.cos(120*Math.PI/180)*100,
    lifespan:4000,
    radial:true,
    rotate: 120,
    scale:1,
    quantity: 6,
    frequency:1000,
}
this.add.particles("myparticle").createEmitter(stepConfig).startFollow(follow);

If you comment out the stepFollow you will see how the particles should appear. Changing the size of the follow object and the size of the x start/end doesn't fix the issue - I originally thought if the width of the follow object was greater than the distance between start and end, it would fix the issue, but it doesn't.

Additional Information

I ran into this issue because I was updating an old game that was using 3.20.0 (beta I think) to 3.55.2 and a particle effect that was suppose to create rain wasn't working right. It's possible that the way it worked in 3.20.0 was actually wrong and that the behavior in 3.55.2 is actually the expected behavior. It's also possible that there is a config setting I'm missing that would fix the issue as well, but I haven't been able to find what that config option is, if one does exist.

@samme
Copy link
Contributor

samme commented Oct 24, 2021

Compare v3.24.1 vs v3.55.2.

@sreadixl
Copy link
Author

Compare v3.24.1 vs v3.55.2.

That doesn't show the issue I was referring to - though the emit point seems to be different - but you can see the issue I was referring to by changing the x property in the emit config to {start:-120, end:120, steps:6}. In 3.24.1 the particles emit along the top of the image in a line, while in 3.55.2 they emit from a single point.

@photonstorm
Copy link
Collaborator

Thank you for submitting this issue. We have fixed this and the fix has been pushed to the master branch. It will be part of the next release. If you get time to build and test it for yourself we would appreciate that.

Test here: https://labs.phaser.io/view.html?src=src/bugs/5847%20step%20particles.js&v=dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants