Page 1 of 1

Can anyone shed a little light on this?

Posted: Tue Jul 22, 2008 7:50 pm
by mrbicrevise
Below is a fragment of code from a really simple program that moves a sprite across the screen, which is sped up by pressing the right shift key. What's driving me nuts is the fact that, while this works fine for all combinations of up (W), down (S) and left (A), it doesn't work at all for right (D) and down when pressed at the same time.

Could anyone explain why this is?

Code: Select all


    ExamineKeyboard()
    ExamineMouse() 
    
    speed = 10
    If KeyboardPushed(#PB_Key_RightShift)
    speed = 30
    EndIf
    
    
     If KeyboardPushed(#PB_Key_W)
        y = y + speed
      EndIf
      
     If KeyboardPushed(#PB_Key_S)   
        y = y - speed
      EndIf
      
     If KeyboardPushed(#PB_Key_D)  
        x = x - speed
      EndIf 
      
        If KeyboardPushed(#PB_Key_A)   
        x = x + speed
      EndIf

Posted: Tue Jul 22, 2008 7:53 pm
by ts-soft
Some combinations of Keys doesn't work on all Keyboards.

Posted: Tue Jul 22, 2008 7:56 pm
by mrbicrevise
Just tried it with the directional arrows, works fine now. Thanks :D

Posted: Tue Jul 22, 2008 8:04 pm
by ts-soft