added entitys, enemys, bats and custom attack hitboxes for players

added map loading and one-way collision (needs to move to tiled attribute tho)

Signed-off-by: Pascal Syma <pascal@syma.dev>
This commit is contained in:
2020-05-20 11:13:21 +02:00
parent 4a22dbe657
commit a726db1306
22 changed files with 2166 additions and 30 deletions
+35
View File
@@ -0,0 +1,35 @@
/*
* Copyright (c) 2020. Pascal Syma <pascal@syma.dev>
* All rights reserved.
*/
import Entity from "../Entity";
export default class Hitbox extends Entity {
constructor(player, dmg) {
super(player.scene, player.body.x, player.body.y, null);
this.setData('dmg', dmg);
this.player = player;
this.setSize(0, 0);
this.setOrigin(0, 0);
this.alpha = 0;
this.body.setAllowGravity(false);
this.setData('active', false);
this.body.setSize(0, 0);
}
update(...args) {
this.setPosition(this.player.body.x, this.player.body.y);
}
start() {
}
overlap(obj) {
this.setData('active', false);
obj.setData('hp', obj.getData('hp') - this.getData('dmg'));
obj.hit();
}
}