key released

Started by fireside, February 21, 2008, 02:53:13 AM

Previous topic - Next topic

fireside

I'm trying to figure out how to get a key released event.  I'm using code from the helloworld

   private void keyAffected(KeyState state) {
      int code=state.getKeyCode();
      boolean event=state.getState();
      switch (code) {

         case (KeyEvent.VK_LEFT): {
            left=event;
            break;
         }
         case (KeyEvent.VK_RIGHT): {
            right=event;
            break;
         }
         case (KeyEvent.VK_DOWN):{
        downPressed = event;
         }

      }
   }


A key released is false, but that's sort of a do nothing state also.
click here->Fireside 7 Games<-

fireside

Oh, never mind.  I made a flag equal to the last state of the downPressed value and checked for a change.
click here->Fireside 7 Games<-