Keyboard Movement: Holding down the key in Tap Mode

Started by Knox, Sat 02/03/2013 21:14:05

Previous topic - Next topic

Knox

I was searching the threads to see if this problem has been posted before and only seemed to find this thread (with no response):
http://www.adventuregamestudio.co.uk/forums/index.php?topic=46041.msg617865#msg617865

Ive come up with a solution, however for some reason it doesnt seem to work when I press the PageUp or PageDown keys (diagonal up right, diagonal down right)
Code: ags

//IN REP EXEC:
void holdKey_TapMode()
{
  if (bKbdTap)
  {
    if (!bPressMode_Temp && (IsKeyPressed(eKeyRightArrow) || IsKeyPressed(eKeyLeftArrow) || IsKeyPressed(eKeyUpArrow) || IsKeyPressed      (eKeyDownArrow) || IsKeyPressed(eKeyPageUp) || IsKeyPressed(eKeyPageDown) || IsKeyPressed(eKeyEnd) || IsKeyPressed(eKeyHome))) 
    { 
      iKbdPressTimer++;
      if (iKbdPressTimer >= 10)
      {
        KeyboardMovement.SetMode(eKeyboardMovement_Pressing);
        bPressMode_Temp = true;
        iKbdPressTimer = 0;
      }
    }
    else if (!IsKeyPressed(eKeyRightArrow) && !IsKeyPressed(eKeyLeftArrow) && !IsKeyPressed(eKeyUpArrow) && !IsKeyPressed(eKeyDownArrow) && !IsKeyPressed(eKeyPageUp) && !IsKeyPressed(eKeyPageDown) && !IsKeyPressed(eKeyEnd) && !IsKeyPressed(eKeyHome)) 
    {
      if (bPressMode_Temp)
      {
        bPressMode_Temp = false;
        KeyboardMovement.SetMode(eKeyboardMovement_Tapping);
      }
    }
  }  
}


What it does is if the user holds down on the key while in tap mode, it will temporarily switch to the press mode so the ugly stuttering no longer happens.

Only thing is, for some reason it doesnt work for those 2 keys (or directions). What am I doing wrong?

Ok, found the prob! Is this a good way of solving the issue?
--All that is necessary for evil to triumph is for good men to do nothing.

SMF spam blocked by CleanTalk