Spawn Explosions centered, add getter for centered coordinates.
This commit is contained in:
parent
b8b0023b02
commit
9a3ac5c9af
|
@ -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() {
|
public int getX() {
|
||||||
return this.x;
|
return this.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Y-Position of the Entity.
|
* Get the Y-Position of the Entity. (top left corner)
|
||||||
*/
|
*/
|
||||||
public int getY() {
|
public int getY() {
|
||||||
return this.y;
|
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.
|
* Set the Entities new absolute position.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class EnemyBoss extends Enemy{
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void explode() {
|
public void explode() {
|
||||||
new MultiExplosion(this.getX(), this.getY());
|
new MultiExplosion(this.getCenteredX(), this.getCenteredY());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class EnemyBossMinion extends Enemy{
|
||||||
* Custom MultiExplosion for this enemy.
|
* Custom MultiExplosion for this enemy.
|
||||||
*/
|
*/
|
||||||
public void explode() {
|
public void explode() {
|
||||||
new MultiExplosion(this.getX(), this.getY());
|
new MultiExplosion(this.getCenteredX(), this.getCenteredY());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class EnemyFour extends Enemy{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void explode() {
|
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
|
@Override
|
||||||
public void explode() {
|
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
|
@Override
|
||||||
public void explode() {
|
public void explode() {
|
||||||
new MultiExplosion(this.getX(), this.getY());
|
new MultiExplosion(this.getCenteredX(), this.getCenteredY());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class EnemyTwo extends Enemy{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void explode() {
|
public void explode() {
|
||||||
new ExplosionTwo(this.getX(), this.getY());
|
new ExplosionTwo(this.getCenteredX(), this.getCenteredY());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue