/* * Copyright (c) 2020. Antonio Martinez Casadesus and Pascal Syma. * 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.hit(this.getData('dmg')); } }