simponic.xyz/centipede/js/game/objects/explosion.js

14 lines
369 B
JavaScript
Raw Normal View History

2024-01-12 21:13:13 -05:00
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;
}