home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 63 / CDACTUAL63.iso / Aplicaciones / DarkBasic / DemoDarkBasic.exe / help / examples / input / exam07.dba < prev    next >
Encoding:
Text File  |  1999-09-07  |  972 b   |  37 lines

  1. Rem * Title  : Simple Joystick
  2. Rem * Author : DBS-LB
  3. Rem * Date   : 1st Sept 99
  4. rem ==============================================
  5. rem DARK BASIC EXAMPLE PROGRAM 7
  6. rem ==============================================
  7. rem This program provides simple joystick movement
  8. rem ----------------------------------------------
  9.  
  10. rem Set a coordinate in the middle of the screen
  11. x=320
  12. y=240
  13.  
  14. rem Begin main loop
  15. do
  16.  
  17. rem Clear the screen each cycle
  18. cls
  19.  
  20. rem Move the coordinate based on the joystick input
  21. if joystick up()=1 then y=y-1
  22. if joystick down()=1 then y=y+1
  23. if joystick left()=1 then x=x-1
  24. if joystick right()=1 then x=x+1
  25.  
  26. rem Set the ink color based on the fire button input
  27. if joystick fire a()=1 then ink rgb(255,0,0),0
  28. if joystick fire b()=1 then ink rgb(0,255,0),0
  29. if joystick fire c()=1 then ink rgb(0,0,255),0
  30. if joystick fire d()=1 then ink rgb(64,0,64),0
  31.  
  32. rem Draw a circle at the coordinate
  33. circle x,y,20
  34.  
  35. rem End the loop
  36. loop
  37.