Keayboard action
Posted: Mon May 15, 2017 4:10 pm
I wont to change the variable FacingAzimuth with the left- or right key.
The code is working but when I tough the key for a short moment PB is so fast the value is change to much.
How can I change the the code in the way that the value is increment or decrement with one independent of how long I
push the button.
Any help will be great
The code is working but when I tough the key for a short moment PB is so fast the value is change to much.
How can I change the the code in the way that the value is increment or decrement with one independent of how long I
push the button.
Any help will be great
Code: Select all
ExamineKeyboard()
If KeyboardReleased(#PB_Key_Escape)
Exit = #True
EndIf
If KeyboardPushed(#PB_Key_Left)
;Debug "#PB_Key_Left"
FacingAzimuth=FacingAzimuth-1
If FacingAzimuth < 0
FacingAzimuth = 0
EndIf
EndIf
If KeyboardPushed(#PB_Key_Right)
;Debug "#PB_Key_Right"
FacingAzimuth=FacingAzimuth+1
If FacingAzimuth > 360
FacingAzimuth = 360
EndIf
EndIf