I'm building a game where the character has to "pick up" a gun to shoot it. My code is:
private void useGun()
{
int gun = 1;
if ( canSee(Gun.class) )
{
remove(Gun.class);
gun = 0;
}
if (gun == 0 && Greenfoot.isKeyDown("space"))
{
getWorld().addObject( new Bullet(), getX(), getY());
Greenfoot.playSound("gunshot.wav");
}
}
Everything compiles, but the character can't use the gun once he picks it up. What am I doing wrong?

