home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 63 / CDACTUAL63.iso / Aplicaciones / DarkBasic / DemoDarkBasic.exe / help / examples / basic3d / exam02.dba < prev    next >
Encoding:
Text File  |  2000-01-24  |  2.3 KB  |  104 lines

  1. Rem * Title  : Managing Models
  2. Rem * Author : DBS-LB
  3. Rem * Date   : 1st Sept 99
  4. rem ==========================================
  5. rem DARK BASIC EXAMPLE PROGRAM 2
  6. rem ==========================================
  7. rem This program manages your models features
  8. rem ------------------------------------------
  9.  
  10. rem Load a bitmap and grab image
  11. load bitmap "floor1.bmp",1
  12. get image 1,0,0,128,128
  13. delete bitmap 1
  14.  
  15. rem Load your object
  16. load object "walk.x",1
  17.  
  18. rem Rotate and fix data so character faces right way
  19. xrotate object 1,0
  20. yrotate object 1,180
  21. zrotate object 1,0
  22. fix object pivot 1
  23.  
  24. rem Immediately hide the object
  25. hide object 1
  26.  
  27. rem Position your object 100 units into the distance
  28. position object 1,0,0,100
  29.  
  30. rem Rotate your object to face an angle of 45 degrees
  31. rotate object 1,0,45,0
  32.  
  33. rem Scale your object to double its width and depth, but not height
  34. scale object 1,200,100,200
  35.  
  36. rem Texture your entire object using the cloth image grabbed and stored in image 1
  37. texture object 1,1
  38.  
  39. rem Color the object
  40. color object 1,rgb(0,255,0)
  41.  
  42. rem Ghost your object to make it semi-transparent
  43. ghost object on 1
  44.  
  45. rem Fade object to 25 percent intensity
  46. fade object 1,25
  47.  
  48. rem Animate your object (loop to frame 25 and back to 5)
  49. loop object 1,5,25
  50.  
  51. rem Show the object
  52. show object 1
  53.  
  54. rem Lock and unlock the object
  55. lock object on 1
  56. lock object off 1
  57.  
  58. rem Reverse rotation
  59. set object rotation xyz 1
  60.  
  61. rem Begin main loop
  62. sync on
  63. draw to front
  64. while mouseclick()=0
  65.  
  66. rem Show FPS
  67. set cursor 0,0
  68. print screen fps()
  69.  
  70. rem Control the object movement with the cursor keys
  71. if upkey()=1 then move object 1,1.0
  72. if downkey()=1 then move object 1,-1.0
  73.  
  74. rem Control the object rotation with the cursor keys
  75. angle#=object angle y(1)
  76. if leftkey()=1 then angle#=wrapvalue(angle#-2)
  77. if rightkey()=1 then angle#=wrapvalue(angle#+2)
  78. yrotate object 1,angle#
  79.  
  80. rem Use the spacebar to point your object to the center of the world
  81. if spacekey()=1 then point object 1,0,0,0
  82.  
  83. rem Syncronise
  84. sync
  85.  
  86. rem Set rotation order back to normal
  87. set object rotation zyx 1
  88.  
  89. rem End main loop
  90. endwhile
  91. draw to back
  92.  
  93. rem Stop your object from animatng
  94. stop object 1
  95.  
  96. rem Switch off ghosting
  97. ghost object off 1
  98.  
  99. rem Free your obejct from memory
  100. delete object 1
  101.  
  102. rem End the program
  103. end
  104.