shootKey = this.Player.playerNum == 0 ? "e": "o";
public class Pipe extends Actor
{
String shootKey;
int shotCoolDown = 0;
public Pipe()
{
shootKey = this.Player.playerNum == 0 ? "e": "o";
GreenfootImage img = new GreenfootImage("Rohr"+(this.Player.playerNum+1)+".PNG");
img.scale(25, 25);
setImage(img);
}
public void act()
{
if (this.Player.getWorld() == null) { getWorld().removeObject(this); return; }
shootStuff();
}
public void shootStuff()
{
if (shotCoolDown > 0) shotCoolDown--;
else if (Greenfoot.isKeyDown(shootKey))
{
getWorld().addObject(new Bullet(getRotation()), getX(), getY());
shotCoolDown = 20;
}
}
}
