Need help in reading the joysticks in QB.. 
Author Message
 Need help in reading the joysticks in QB..

This goes to the QBasic "expert"... for which I am not.

Can you help me in reading those darn analog joysticks?? I would like to
read them and whatever data I get from them, I would like to change it
into a simple "digital-style" format. Like, for example..:

Joystick = stick(x)
' calculations..
' calculations..
IF Joystick = 1 then ' up
IF Joystick = 2 then ' down
IF Joystick = 3 then ' left
IF Joystick = 4 then ' right
so on.. so on..

Can you spare some .BAS routines?? or some suggestions?? Thank you.
Please E-mail me in advance.



Thu, 28 May 1998 03:00:00 GMT  
 Need help in reading the joysticks in QB..
     My best suggestion would be to use stick calibration.  Ask the user
to center his/her stick and press a key.  Store the STICK(0) and STICK(1)
values into variables.  Run a constant test in the program to see if
STICK(0) or STICK(1) are greater or less than the variables:

If STICK(0) > XCoor then Direction = 4
If STICK(1) > YCoor then Direction = 3
..

     Basically, when the user presses up on the joystick, the program
will record that STICK(1) < YCoor.  You can also add an invisible square
around XCoor and YCoor to prevent unwanted joystick movement:

If STICK(0) > XCoor + 5 then Direction = 4
If STICK(0) < XCoor - 5 then Direction = 1

     I have not used this method in any of my programs, so test results
would be appreciated.




Sun, 31 May 1998 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Trouble using joystick in QB

2. HELP: Reading a Joystick?

3. Need to read/write to OS9 formatted floppys from VB or QB

4. NEED HELP DISABLING QB COMMANDS:IMMEDIATE REP. NEEDED

5. Help needed in QB4.5 (Joystick/Mouse)

6. Need help with Joystick positions and buttons

7. Need help accessing Joystick in VB

8. need help on a QB graphics routine.

9. QB 4.5 SHELL command in large programme help needed

10. * Need help with QB 4.0

11. I need help with arrays QB

12. Need help adding QC functions to QB library.

 

 
Powered by phpBB® Forum Software