silphius/resources/misc/death-default.js
2024-09-17 01:25:39 -05:00

23 lines
435 B
JavaScript

const {Sprite, Ticking, Vulnerable} = entity;
if (Vulnerable) {
Vulnerable.isInvulnerable = 1;
}
if (Sprite) {
const {promise} = transition(
entity.Sprite,
{
scaleX: {
duration: 0.25,
magnitude: -entity.Sprite.scaleX,
},
scaleY: {
duration: 0.25,
magnitude: entity.Sprite.scaleY * 2,
},
},
)
Ticking.add(promise);
await promise;
ecs.destroy(entity.id);
}