Add canShoot attribute to ShootingEntity.
This commit is contained in:
parent
aedbd55159
commit
a91a60381c
|
@ -4,6 +4,8 @@ import de.teamteamteam.spacescooter.entity.shot.SingleBlueShot;
|
|||
|
||||
public abstract class ShootingEntity extends LivingEntity {
|
||||
|
||||
private boolean canShoot = true;
|
||||
|
||||
private int shootDelay;
|
||||
private int currentShootDelay;
|
||||
private int shootSpawnX;
|
||||
|
@ -23,12 +25,22 @@ public abstract class ShootingEntity extends LivingEntity {
|
|||
}
|
||||
|
||||
protected void shoot() {
|
||||
if(this.currentShootDelay == 0) {
|
||||
new SingleBlueShot(this.x + this.shootSpawnX, this.y + this.shootSpawnY, this.shootDirection, this.shootSpeed, this.damageValue);
|
||||
this.currentShootDelay = this.shootDelay;
|
||||
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.currentShootDelay = this.shootDelay;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setCanShoot(boolean canShoot) {
|
||||
this.canShoot = canShoot;
|
||||
}
|
||||
|
||||
public boolean canShoot() {
|
||||
return this.canShoot;
|
||||
}
|
||||
|
||||
public void setShootDirection(int direction) {
|
||||
this.shootDirection = direction;
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ public class GameOverScreen extends Screen {
|
|||
new Button(GameConfig.windowWidth/2-125, 400);
|
||||
player = new Player(GameConfig.windowWidth/2-170, 309);
|
||||
player.setCanMove(false);
|
||||
player.setCanShoot(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -32,6 +32,7 @@ public class GamePausedScreen extends Screen {
|
|||
new Button(GameConfig.windowWidth/2-125, 400);
|
||||
player = new Player(GameConfig.windowWidth/2-170, 309);
|
||||
player.setCanMove(false);
|
||||
player.setCanShoot(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -35,6 +35,7 @@ public class MainMenuScreen extends Screen {
|
|||
new Button(GameConfig.windowWidth/2-125, 500);
|
||||
player = new Player(GameConfig.windowWidth/2-170, 209);
|
||||
player.setCanMove(false);
|
||||
player.setCanShoot(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue