ParticleEmitter `speedX` and `speedY` Not Updating After Initial Creation
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 40.3k
- Forks
- 7.2k
- PR merge metrics
- No merged PRs in 30d
Description
Version
- Phaser Version: 3.85.0-beta.2
After creating a ParticleEmitter, subsequent changes to the emitter's speedX and speedY properties are not taken into account. Below is a minimal example demonstrating this issue. When the emitter is triggered on a pointer down event, the speed is supposed to be set to zero, but the particles still maintain their initial speed.
Example Test Code
To be pasted in this example:
class Example extends Phaser.Scene
{
preload ()
{
this.load.atlas('flares', 'assets/particles/flares.png', 'assets/particles/flares.json');
}
create ()
{
const emitter = this.add.particles(400, 250, 'flares', {
frame: [ 'red', 'yellow', 'green' ],
lifespan: 4000,
speed: { min: 150, max: 250 },
scale: { start: 0.8, end: 0 },
gravityY: 150,
blendMode: 'ADD',
emitting: false
});
this.input.on('pointerdown', pointer => {
emitter.explode(16);
// Attempt to change particle speed to zero
emitter.speedX = 0;
emitter.speedY = 0;
emitter.setParticleSpeed(0,0);
});
this.add.text(10, 10, 'Click to explode emit particles');
}
}
const config = {
type: Phaser.AUTO,
width: 800,
height: 600,
backgroundColor: '#000',
parent: 'phaser-example',
scene: Example
};
const game = new Phaser.Game(config);
Expected Behavior:
When the emitter is triggered by the pointer down event, the particle speed should be updated to the new values set (speedX and speedY to 0), resulting in particles emitting with no horizontal or vertical speed.
Actual Behavior:
Despite setting speedX and speedY to 0, the particles still emit with their initial speed values.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue using the linked explode emitter example and the Phaser.Scene code in the report. Start by tracing ParticleEmitter handling for speedX, speedY, and setParticleSpeed after creation. Done means changing both values to zero before emission results in particles with no horizontal or vertical speed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100