diff --git a/src/de/teamteamteam/spacescooter/entity/Entity.java b/src/de/teamteamteam/spacescooter/entity/Entity.java index a625028..c362d39 100644 --- a/src/de/teamteamteam/spacescooter/entity/Entity.java +++ b/src/de/teamteamteam/spacescooter/entity/Entity.java @@ -80,19 +80,33 @@ public abstract class Entity implements Updateable, Paintable { /** - * Get the X-Position of the Entity. + * Get the X-Position of the Entity. (top left corner) */ public int getX() { return this.x; } /** - * Get the Y-Position of the Entity. + * Get the Y-Position of the Entity. (top left corner) */ public int getY() { return this.y; } + /** + * Get the centered X-Position of the Entity. + */ + public int getCenteredX() { + return this.x + (this.width / 2); + } + + /** + * Get the centered Y-Position of the Entity. + */ + public int getCenteredY() { + return this.y + (this.height / 2); + } + /** * Set the Entities new absolute position. */ diff --git a/src/de/teamteamteam/spacescooter/entity/enemy/EnemyBoss.java b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyBoss.java index 086b078..7a54c65 100644 --- a/src/de/teamteamteam/spacescooter/entity/enemy/EnemyBoss.java +++ b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyBoss.java @@ -38,7 +38,7 @@ public class EnemyBoss extends Enemy{ */ @Override public void explode() { - new MultiExplosion(this.getX(), this.getY()); + new MultiExplosion(this.getCenteredX(), this.getCenteredY()); } @Override diff --git a/src/de/teamteamteam/spacescooter/entity/enemy/EnemyBossMinion.java b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyBossMinion.java index 6ef4a5e..155a1be 100644 --- a/src/de/teamteamteam/spacescooter/entity/enemy/EnemyBossMinion.java +++ b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyBossMinion.java @@ -38,7 +38,7 @@ public class EnemyBossMinion extends Enemy{ * Custom MultiExplosion for this enemy. */ public void explode() { - new MultiExplosion(this.getX(), this.getY()); + new MultiExplosion(this.getCenteredX(), this.getCenteredY()); } @Override diff --git a/src/de/teamteamteam/spacescooter/entity/enemy/EnemyFour.java b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyFour.java index cef862e..4cfd6ff 100644 --- a/src/de/teamteamteam/spacescooter/entity/enemy/EnemyFour.java +++ b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyFour.java @@ -68,7 +68,7 @@ public class EnemyFour extends Enemy{ @Override public void explode() { - new ExplosionOne(this.getX(), this.getY()); + new ExplosionOne(this.getCenteredX(), this.getCenteredY()); } } diff --git a/src/de/teamteamteam/spacescooter/entity/enemy/EnemyOne.java b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyOne.java index 2a75ecb..a4da967 100644 --- a/src/de/teamteamteam/spacescooter/entity/enemy/EnemyOne.java +++ b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyOne.java @@ -25,7 +25,7 @@ public class EnemyOne extends Enemy { @Override public void explode() { - new ExplosionOne(this.getX(), this.getY()); + new ExplosionOne(this.getCenteredX(), this.getCenteredY()); } } diff --git a/src/de/teamteamteam/spacescooter/entity/enemy/EnemyThree.java b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyThree.java index f234f4d..8a6f5fa 100644 --- a/src/de/teamteamteam/spacescooter/entity/enemy/EnemyThree.java +++ b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyThree.java @@ -41,7 +41,7 @@ public class EnemyThree extends Enemy{ */ @Override public void explode() { - new MultiExplosion(this.getX(), this.getY()); + new MultiExplosion(this.getCenteredX(), this.getCenteredY()); } @Override diff --git a/src/de/teamteamteam/spacescooter/entity/enemy/EnemyTwo.java b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyTwo.java index 9e0a9c6..ed48097 100644 --- a/src/de/teamteamteam/spacescooter/entity/enemy/EnemyTwo.java +++ b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyTwo.java @@ -32,7 +32,7 @@ public class EnemyTwo extends Enemy{ @Override public void explode() { - new ExplosionTwo(this.getX(), this.getY()); + new ExplosionTwo(this.getCenteredX(), this.getCenteredY()); } }