joystick problems

Blitz3D Forums/Blitz3D Beginners Area/joystick problems

shawnus(Posted 2009) [#1]
Hi, I am having some joystick issues, this is the code:


If JoyDown(1) = 5 Then
(...do A)


Else If JoyDown(1) = 4 Then
(...do B)


EndIf

the above works with mousedown, but substituting with joydown doesn't.

Also, if I replace joydown with getjoy, the 1st line works (ie if I press the joystick button 5, do A works), but if I press button 4, do B doesn't work.

The whole joystick 'thing' seems a bit hit & miss to me as well. I have 2 joysticks which I command by using their port identifiers, but the trigger button on joystick port 0 works if I call it from joystick port 1, yet the movements are correct (ie. joystick '0' controls movement of object x, joystick '1' controls movement of object y.

any help appreciated.

Shawnus


Stevie G(Posted 2009) [#2]
You're not using the command correctly ...

http://www.blitzbasic.com/b3ddocs/command.php?name=JoyDown&ref=2d_a-z

Joydown(1) is checking port 0 for button 1 all the time. It returns true or false, not 4 or 5.


shawnus(Posted 2009) [#3]
Stevie G, thanks, dont know what I was thinking. works fine.
Shawnus