added win screen and level system
Signed-off-by: Pascal Syma <pascal@syma.dev>
This commit is contained in:
+1
-12
@@ -33,21 +33,10 @@ export default class Entity extends Phaser.GameObjects.Sprite {
|
||||
if (shouldDie) {
|
||||
this.body.velocity.x = 0;
|
||||
this.setData('active', false);
|
||||
this.die();
|
||||
} else {
|
||||
setTimeout(() => this.hitCooldown = false, 1000);
|
||||
}
|
||||
|
||||
if (this.hitAnimation !== null) {
|
||||
// TODO: bug, not working, no clue why not
|
||||
this.anims.stop();
|
||||
this.play(this.hitAnimation)
|
||||
.once('animationcomplete', () => {
|
||||
if (shouldDie) this.die()
|
||||
});
|
||||
} else {
|
||||
if (shouldDie)
|
||||
this.die();
|
||||
}
|
||||
}
|
||||
|
||||
die() {
|
||||
|
||||
Reference in New Issue
Block a user