simponic.xyz/centipede/js/game/objects/explosion.js
2024-01-12 19:13:13 -07:00

14 lines
369 B
JavaScript

game.Explosion = (spec) => {
const object = game.Object(spec);
let explosionTime = 0;
const parentUpdate = object.update;
object.update = (elapsedTime) => {
parentUpdate(elapsedTime);
explosionTime += elapsedTime;
if (explosionTime > (object.sprite.numFrames * object.sprite.timePerFrame)) {
object.alive = false;
}
}
return object;
}