hello i am making a game and i added shooting but i am stuck on 2 things first off i want so i cant hold down space and it constantly shoots and i also want it where it shoots in the direction i am looking my code rn looks like this
  public void attack()
    {
        if(Greenfoot.isKeyDown("space"))
        {
            Attack1 attack1 = new Attack1();
            getWorld().addObject(attack1, getX(), getY());
            
        }
        
        
        
    }
          
        
  
