Can anyone shed a little light on this?
Posted: Tue Jul 22, 2008 7:50 pm
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?
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