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

phaser 3.5.0 Emiter add texture to all other sprite #3583

Closed
murteira opened this issue Apr 17, 2018 · 6 comments
Closed

phaser 3.5.0 Emiter add texture to all other sprite #3583

murteira opened this issue Apr 17, 2018 · 6 comments

Comments

@murteira
Copy link

murteira commented Apr 17, 2018

When create an emiter in version 3.4.0 works ok, but on 3.5.0 they add the same texture defined in particle to all other images in game, while executing.

this.emitter0 = this.add.particles("start").createEmitter({
            x: 0,
            y: 0,
            speed: { min: -800, max: 800 },
            angle: { min: 0, max: 360 },
            scale: { start: 0.5, end: 0 },
            blendMode: 'SCREEN',
            active: false,
            lifespan: 600,
            gravityY: 0
        });
        this.emitter0.setScrollFactor(1);
this.emitter0.setPosition(asteroid.x, asteroid.y);
                this.emitter0.active = true;
                this.emitter0.explode(15);

In this example, as soon as i call explode() all other images in game gets an "start" overlay.

@photonstorm
Copy link
Collaborator

Would you mind turning your code into a runnable example please? (using assets from the labs if possible), because I just tried the following code and no images changed when the emitter started:

var config = {
    type: Phaser.WEBGL,
    width: 800,
    height: 600,
    backgroundColor: '#000',
    parent: 'phaser-example',
    scene: {
        preload: preload,
        create: create
    }
};

var game = new Phaser.Game(config);

function preload ()
{
    this.load.atlas('flares', 'assets/particles/flares.png', 'assets/particles/flares.json');
    this.load.image('logo', 'assets/sprites/phaser3-logo.png');
}

function create ()
{
    var particles = this.add.particles('flares');

    var emitter = particles.createEmitter({
        active: false,
        frame: 'blue',
        x: 200,
        y: 300,
        lifespan: 2000,
        speed: { min: 400, max: 600 },
        angle: 330,
        gravityY: 300,
        scale: { start: 0.4, end: 0 },
        quantity: 2,
        blendMode: 'ADD'
    });

    this.input.once('pointerdown', function (event) {
    
        emitter.active = true;
    
    }, this);

    this.add.image(400, 300, 'logo');
}

@murteira
Copy link
Author

I can't replicate this in a fiddle, maybe its because some other file in game, because i'm using Matter physics.

Is there any way so i can send you a private link? For you to test?

@photonstorm
Copy link
Collaborator

The physics won't make any difference to the rendering. You could email me a link, but if it's a complex or large code base, I'll warn you now: I won't have time to go through it all.

@photonstorm
Copy link
Collaborator

We can now reproduce this bug internally. The cause is an emitter with a blend mode. We're looking into it now.

@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.

@murteira
Copy link
Author

Its working perfect!

Thanks for fast support!

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

2 participants