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

Particle position incorrect for first rendered frame when camera is panned away from world origin #73

Closed
trixiegoff opened this issue Sep 28, 2013 · 0 comments

Comments

@trixiegoff
Copy link

Particles emitted while the camera is panned away from the world origin, and where the emitter would be outside the visible area if the camera were at world origin, are displayed for their first frame in an incorrect location. After the first rendered frame of the particle's existance, the position is correct, resulting in a brief flash in the incorrect position.

This appears to be because of the following in the reset function setting sprite.position.x/y, which I believe are the display coordinates, to be the passed world coordinates:

Phaser.Sprite.prototype.reset = function(x, y) {
    this.x = x;
    this.y = y;
    this.position.x = x;
    this.position.y = y;

Upon replacing:

    this.position.x = x;
    this.position.y = y;

with:

    this.position.x = this.x - (this.game.world.camera.x * this.scrollFactor.x);
    this.position.y = this.y - (this.game.world.camera.y * this.scrollFactor.y);

the behavior ceases to occur.

While I assume that this issue can occur with any other sprite, I've been unable to replicate it outside of the particle emitter.

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

No branches or pull requests

2 participants