added a whole lot of crap

Signed-off-by: Pascal Syma <pascal@syma.dev>
This commit is contained in:
2020-07-15 23:47:44 +02:00
parent 4edf8453d1
commit e3b9eff67d
25 changed files with 4490 additions and 59 deletions
+14 -10
View File
@@ -12,7 +12,7 @@ export default class Player extends Entity {
constructor(scene, spawnPoint, texture) {
super(scene, spawnPoint.x, spawnPoint.y, texture);
this.setData("speed", 100);
this.setData('hp', 20);
this.setData('hp', 10);
this.setOrigin(0.5, 1).setScale(32 / 48);
this.body.setSize(48, 48, false);
@@ -29,6 +29,9 @@ export default class Player extends Entity {
]);
this.items = [];
this.dieAnimation = 'die';
this.hitAnimation = 'hit';
}
pickup(item) {
@@ -45,15 +48,6 @@ export default class Player extends Entity {
}
update(...args) {
// if (this.scene.dieActive()) {
// this.pause = true;
// this.play('die', true)
// .once('animationcomplete', () => {
// this.setFrame(51);
// this.scene.scene.pause();
// })
// }
if (this.pause)
return;
@@ -112,4 +106,14 @@ export default class Player extends Entity {
this.items.shift().die();
}
}
die() {
this.anims.stop();
this.pause = true;
this.play(this.dieAnimation)
.once('animationcomplete', () => {
this.setFrame(51);
this.scene.scene.pause();
})
}
}