public void act() 
    {
        // Add your action code here.
        if (Greenfoot.isKeyDown(" ")){
            fire();}
        if (Greenfoot.isKeyDown("left")){
            move(-speed);}
        
        if (Greenfoot.isKeyDown("right")){
            move(speed);}
        
        if (bullet != null)
        {
            if (bullet.getY() < 5)
            {
                world.removeObject(bullet);
                isFiring = false;
                bullet = null;
            }
        }
    }