From 46efd1e04e69915d427537468ec6a451b19883a3 Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Wed, 5 Nov 2014 22:54:54 +0100 Subject: [PATCH] Create overridable method that actually spawns Shot objects. --- .../spacescooter/entity/ShootingEntity.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/de/teamteamteam/spacescooter/entity/ShootingEntity.java b/src/de/teamteamteam/spacescooter/entity/ShootingEntity.java index 821933b..618f308 100644 --- a/src/de/teamteamteam/spacescooter/entity/ShootingEntity.java +++ b/src/de/teamteamteam/spacescooter/entity/ShootingEntity.java @@ -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; }