Log in

View Full Version : Joystick


cammie825
15-01-2003, 10:40
I had a question about the abilities of our joysticks. Is there a way to program the buttons or triggers so that when you continuously hold the trigger the action is performed, and when the trigger is released the action stops?

D.Viddy
15-01-2003, 10:48
It's going to look something like this (note: I use the underscores for indention purposes only, do not include them in your code):

'If port1 trigger is pressed then
If p1_sw_trig = 1 then
_____'Perform Action Here
endif

Or if you wanted it so when you pressed a joy button it would turn an action on, and when you pressed it again, it would do another action then:

'Declare this variable at top of code
action_on VAR byte

'If port1 trigger is pressed then
If p1_sw_trig = 1 then
_____'Switch from on to off
_____toggle action_on
endif

'If alternate action is specified then
If action_on = 1 then
____'Do action here
else
____'Do another action here
end if