added item chests, audio and deployment
Signed-off-by: Pascal Syma <pascal@syma.dev>
This commit is contained in:
@@ -17,7 +17,7 @@ export default class Entity extends Phaser.GameObjects.Sprite {
|
||||
}
|
||||
|
||||
hit(dmg) {
|
||||
if (dmg <= 0)
|
||||
if (dmg === 0)
|
||||
return;
|
||||
|
||||
if (this.hitCooldown)
|
||||
@@ -25,8 +25,8 @@ export default class Entity extends Phaser.GameObjects.Sprite {
|
||||
|
||||
this.hitCooldown = true;
|
||||
|
||||
this.setData('hp', this.getData('hp') - dmg);
|
||||
console.log(this, this.getData('hp'));
|
||||
const newHp = this.getData('hp') - dmg;
|
||||
this.setData('hp', newHp < 0 ? 0 : newHp);
|
||||
|
||||
// play hit animation
|
||||
const shouldDie = this.getData('hp') <= 0;
|
||||
@@ -38,6 +38,7 @@ export default class Entity extends Phaser.GameObjects.Sprite {
|
||||
}
|
||||
|
||||
if (this.hitAnimation !== null) {
|
||||
// TODO: bug, not working, no clue why not
|
||||
this.anims.stop();
|
||||
this.play(this.hitAnimation)
|
||||
.once('animationcomplete', () => {
|
||||
|
||||
Reference in New Issue
Block a user