Spawn Explosions centered, add getter for centered coordinates.
This commit is contained in:
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user