Skip to content

Commit 4597fce

Browse files
committed
Fixed problem with ghost disappearing
1 parent 3bd6819 commit 4597fce

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pet-utils/ghost.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,18 @@ export class Ghost extends Pet {
4848
await new Promise((res) => setTimeout(res, delay2));
4949
}
5050
}
51+
52+
public async destroy() {
53+
if (this.isDestroyed) return;
54+
this.isDestroyed = true;
55+
56+
// Fade out and then remove (to replace death animation)
57+
this.petEl.setCssProps({
58+
transition: "opacity 1s ease",
59+
opacity: "0"
60+
});
61+
setTimeout(() => {
62+
this.petEl.remove();
63+
}, 1000);
64+
}
5165
}

0 commit comments

Comments
 (0)