I'd like to have the Player shoot 15 shots, then not be able to until they collect a ammoBox which then adds 15 more shots.
Please help, this has been frustrating me.
public void Shooting()
{
if(Greenfoot.isKeyDown("space") && readEnter)
{
if(Ammo>0)
{
getWorld().addObject(new Bullet(getRotation()), getX() , getY());
readEnter = false;
Ammo--;
}
else
{
}
}
public void Collecting()
{
if(canSee(healthBox.class))
{
eat(healthBox.class);
Health = Health + 2;
Greenfoot.playSound("healthPickup.mp3");
}
if(canSee(ammoBox.class))
{
eat(ammoBox.class);
Ammo = Ammo + 15;
Greenfoot.playSound("ammoPickup.mp3");
}
} public Player()
{
image1 = new GreenfootImage("stillRight.png");
image2 = new GreenfootImage("stillLeft.png");
image3 = new GreenfootImage("shootRight.png");
image4 = new GreenfootImage("shootLeft.png");
image5 = new GreenfootImage("moveRight.png");
image6 = new GreenfootImage("moveLeft.png");
image7 = new GreenfootImage("bulletRight.png");
image8 = new GreenfootImage("bulletLeft.png");
Ammo = 15;
Health = 2;
}


