Create overridable method that actually spawns Shot objects.

This commit is contained in:
Jan Philipp Timme 2014-11-05 22:54:54 +01:00
parent 0c270c8665
commit 46efd1e04e
1 changed files with 9 additions and 2 deletions

View File

@ -27,12 +27,19 @@ public abstract class ShootingEntity extends LivingEntity {
protected void shoot() {
if(this.canShoot == true) {
if(this.currentShootDelay == 0) {
new SingleBlueShot(this.x + this.shootSpawnX, this.y + this.shootSpawnY, this.shootDirection, this.shootSpeed, this.damageValue);
this.createShot();
this.currentShootDelay = this.shootDelay;
}
}
}
/**
* Override this method in the actual enemy class to change the type of shot the entity creates.
*/
public void createShot() {
new SingleBlueShot(this.x + this.shootSpawnX, this.y + this.shootSpawnY, this.shootDirection, this.shootSpeed, this.damageValue);
}
public void setCanShoot(boolean canShoot) {
this.canShoot = canShoot;
}