home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 63 / CDACTUAL63.iso / Aplicaciones / DarkBasic / DemoDarkBasic.exe / help / examples / matrix3d / exam06.dba < prev    next >
Encoding:
Text File  |  1999-09-07  |  1.4 KB  |  74 lines

  1. Rem * Title  : Matrix Smoothscroll
  2. Rem * Author : DBS-LB
  3. Rem * Date   : 1st Sept 99
  4. rem ===========================================
  5. rem DARK BASIC EXAMPLE PROGRAM 6
  6. rem ===========================================
  7. rem This program will smooth scroll a matrix
  8. rem -------------------------------------------
  9.  
  10. load bitmap "floor1.bmp",1
  11. get image 1,0,0,256,256
  12. delete bitmap 1
  13.  
  14. rem Make a matrix
  15. make matrix 1,1000,1000,20,20
  16.  
  17. rem Randomize the matrix
  18. randomize matrix 1,150.0
  19. set matrix height 1,10,10,200.0
  20. update matrix 1
  21.  
  22. rem Prepare matrix with a texture cut into a 2x2 texture grid 
  23. prepare matrix texture 1,1,2,2
  24.  
  25. rem Position camera
  26. position camera 500,400,-200
  27. point camera 500,0,500
  28.  
  29. rem Add depth effect
  30. fog on
  31. fog distance 1500
  32.  
  33. rem Activate manual sync
  34. sync on
  35.  
  36. rem Begin main loop
  37. while mouseclick()=0
  38.  
  39. rem Smooth scroll the matrix
  40. if upkey()=1 then sz#=sz#-5.0
  41. if downkey()=1 then sz#=sz#+5.0
  42. if leftkey()=1 then sx#=sx#+5.0
  43. if rightkey()=1 then sx#=sx#-5.0
  44. if sx#<0.0
  45.     shift matrix left 1
  46.     sx#=sx#+50.0
  47. endif
  48. if sx#>=50.0
  49.     shift matrix right 1
  50.     sx#=sx#-50.0
  51. endif
  52. if sz#<0.0
  53.     shift matrix up 1
  54.     sz#=sz#+50.0
  55. endif
  56. if sz#>=50.0
  57.     shift matrix down 1
  58.     sz#=sz#-50.0
  59. endif
  60. position matrix 1,sx#,0,sz#
  61.  
  62. rem Syncronise
  63. sync
  64.  
  65. rem End main loop
  66. endwhile
  67.  
  68. rem Delete the matrix
  69. delete matrix 1
  70.  
  71. rem End the program
  72. end
  73.  
  74.