Skip to content

[4.0.0-rc.6] Using Phaser.BlendModes.ADD on a ParticleEmitterConfig can bleed into other sprites on the same layer #7233

@saintflow47

Description

@saintflow47

Version

  • Phaser Version: 4.0.0
  • Operating system: Windows 11
  • Browser: Google Chrome

Description

Using Phaser.BlendModes.ADD on a ParticleEmitterConfig blendMode that is part of a container can bleed into other sprites on the same layer that should not be influenced by that blendMode.

Example Test Code

Reproducable Code when run at: https://labs.phaser.io/
card2 should not be influenced by blendMode, but receives it. I am not exactly sure if this is the same issue I'm experiencing in Bubbits as there are a lot more containers sprites and layers involved, but this was the smallest code example I could come up with that seems to show a similar issue.

`class Example extends Phaser.Scene
{
preload ()
{
// this.load.setBaseURL('https://cdn.phaserfiles.com/v385');
this.load.image('bg', 'assets/skies/darkstone.png');
this.load.image('flare', 'assets/particles/white-flare.png');
this.load.image('slug', 'assets/pics/card1.png');
this.load.image('fox', 'assets/pics/card3.png');
this.load.atlas('walker', 'assets/animations/walker.png', 'assets/animations/walker.json');
}

create ()
{
    this.add.image(400, 300, 'bg');
    const testLayer = this.add.layer();
    const container = this.add.container();
    const card1 = this.add.image(225, 300, 'walker', "frame_0000")
    const card2_2 = this.add.image(575, 300, 'slug')
    const card2 = this.add.image(575, 300, 'fox')
    

    const emitZone1 = { type: 'edge', source: card1.getBounds(), quantity: 42 };
    const emitZone2 = { type: 'edge', source: card2.getBounds(), quantity: 42 };

    const emitter = this.add.particles(0, 0, 'walker', {
        frame: ["frame_0000", "frame_0001", "frame_0002"],
        speed: 24,
        lifespan: 1500,
        quantity: 1,
        scale: { start: 0.4, end: 0 },
        alpha: { start: 0.4, end: 0 },
        advance: 2000,
        blendMode: "ADD",
        emitting: true,
        emitZone: [ emitZone1, emitZone2 ]
    });

    const emitter2 = this.add.particles(0, 0, 'walker', {
        frame: ["frame_0000", "frame_0001", "frame_0002"],
        speed: 24,
        lifespan: 1500,
        quantity: 1,
        scale: { start: 0.4, end: 0 },
        alpha: { start: 0.4, end: 0 },
        advance: 2000,
        blendMode: "ADD",
        emitZone: [ emitZone1, emitZone2 ]
    });

    container.add(card1)
    container.add(emitter)
    container.add(emitter2)

    testLayer.add(card1)
    testLayer.add(card2)
    testLayer.add(emitter)
    testLayer.add(emitter2)

}

}

const config = {
type: Phaser.AUTO,
width: 800,
height: 600,
backgroundColor: '#000',
parent: 'phaser-example',
scene: Example
};

const game = new Phaser.Game(config);
`

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions