home *** CD-ROM | disk | FTP | other *** search
- Rem * Title : Analogue Joystick
- Rem * Author : DBS-LB
- Rem * Date : 1st Sept 99
- rem ===============================================
- rem DARK BASIC EXAMPLE PROGRAM 8
- rem ===============================================
- rem This program detects analogue joystick movement
- rem -----------------------------------------------
-
- rem Set a coordinate in the middle of the screen
- x=320
- y=240
-
- Rem Activate manual sync
- sync on
-
- rem Begin main loop
- do
-
- rem Clear screen
- cls
-
- rem Show the analogue values
- set cursor 0,10
- print joystick x()
- print joystick y()
- print joystick z()
- print joystick slider a()
- print joystick slider b()
-
- rem Move the coordinate based on the joystick axis value
- x=x+(joystick x()/100)
- y=y+(joystick y()/100)
-
- rem Make sure the coordinate does not leave the screen
- if x<0 then x=0
- if x>640 then x=640
- if y<0 then y=0
- if y>480 then y=480
-
- rem Draw a circle at the coordinate
- circle x,y,20
-
- Rem Syncronise drawing
- sync
-
- rem End the loop
- loop
-