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

Fix issue #129 - PathParticle throws error when no speed interp #130

Merged
merged 2 commits into from
Apr 30, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions src/PathParticle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export class PathParticle extends Particle
* Total single directional movement, due to speed.
*/
public movement: number;

/**
* @param {PIXI.particles.Emitter} emitter The emitter that controls this PathParticle.
*/
Expand Down Expand Up @@ -150,8 +150,13 @@ export class PathParticle extends Particle
if(lerp >= 0 && this.path)
{
//increase linear movement based on speed
const speed = this.speedList.interpolate(lerp) * this.speedMultiplier;
this.movement += speed * delta;
if(this._doSpeed) {
const speed = this.speedList.interpolate(lerp) * this.speedMultiplier;
this.movement += speed * delta;
} else {
const speed = ParticleUtils.length(this.velocity);
this.movement += speed * delta;
}
//set up the helper point for rotation
helperPoint.x = this.movement;
helperPoint.y = this.path(this.movement);
Expand All @@ -161,7 +166,7 @@ export class PathParticle extends Particle
}
return lerp;
}

/**
* Destroys the particle, removing references and preventing future use.
*/
Expand Down Expand Up @@ -215,4 +220,4 @@ export class PathParticle extends Particle
}
return output;
}
}
}