title: Greenfoot: How do I make it so I press a button once and it keeps acting?
body: <p>Title, I want to make my program shoot a ball when you press the button once, and then it keeps going and you can't do anything until it finishes.  Current code for firing below.</p>
  
  <pre><code>public void act() 
  {
          // Steps for calculating the launch speed and angle
          ProjectileWorld myWorld = (ProjectileWorld) getWorld();
          double shotStrength = myWorld.getSpeedValue();
          double shotAngle = myWorld.getAngleValue();
          // Checks to see if the space key is pressed, if it is, the projectile is fired
          String key = Greenfoot.getKey();  
          if ("space".equals(key))
          { 
              //xSpeed and ySpeed changed as requirements say
              xSpeed = (int)(shotStrength*Math.cos(shotAngle));
              ySpeed = -(int)(shotStrength*Math.sin(shotAngle));
              actualX += xSpeed;
              actualY += ySpeed;
              setLocation ((int) actualX, (int) actualY);
          }
  </code></pre>
  
  <p>right now this makes it so the ball only moves when I hold spacebar, and since that's the case, I can let go of the space bar and change the shotStrength and shotAngle while the ball is still in the air</p>