home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 63 / CDACTUAL63.iso / Aplicaciones / DarkBasic / DemoDarkBasic.exe / help / examples / basic3d / exam05.dba < prev    next >
Encoding:
Text File  |  2000-04-09  |  2.5 KB  |  100 lines

  1. Rem * Title  : Adding Limbs
  2. Rem * Author : DBS-LB
  3. Rem * Date   : 1st Sept 99
  4. rem ===============================================
  5. rem DARK BASIC EXAMPLE PROGRAM 5
  6. rem ===============================================
  7. rem This program adds a new limb to an object
  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 "idle.x",1
  17.  
  18. rem Find out how many limbs the object has and hide them
  19. perform checklist for object limbs 1
  20. numberoflimbs=checklist quantity()
  21. for t=1 to numberoflimbs : hide limb 1,t : next t
  22.  
  23. rem Load a mesh
  24. load mesh "mesh.x",1
  25.  
  26. rem Make sure mesh does exist
  27. if mesh exist(1)=1
  28.     rem Add and link the mesh to one of the objects limbs
  29.     numberoflimbs=numberoflimbs+1
  30.     add limb 1,numberoflimbs,1
  31.     link limb 1,numberoflimbs,4
  32.  
  33.     rem Hide original limb and show new one
  34.     hide limb 1,4
  35.     show limb 1,numberoflimbs
  36.  
  37.     rem Texture the limb using the pre-grabbed image
  38.     texture limb 1,numberoflimbs,1
  39.  
  40.     rem Scale, rotate and offset the limb
  41.     scale limb 1,numberoflimbs,2000,2000,2000
  42.     rotate limb 1,numberoflimbs,45,0,0
  43.     offset limb 1,numberoflimbs,0,-20,0
  44.     color limb 1,numberoflimbs,rgb(255,255,0)
  45.  
  46.     worldx = limb position x(1,numberoflimbs)
  47.     worldy = limb position y(1,numberoflimbs)
  48.     worldz = limb position z(1,numberoflimbs)
  49.     worldanglex = limb direction x(1,numberoflimbs)
  50.     worldangley = limb direction y(1,numberoflimbs)
  51.     worldanglez = limb direction z(1,numberoflimbs)
  52.  
  53. endif
  54.  
  55. rem Deactivate backdrop
  56. backdrop off
  57.  
  58. rem Scroll through object limbs
  59. for l=0 to numberoflimbs
  60.  
  61. rem Clear the screen
  62. cls
  63.  
  64. rem Show each limb as it is viewed
  65. show limb 1,l
  66.  
  67. rem Print information about object
  68. print "Limb Information"
  69. print "----------------"
  70. print
  71. print "Limb Number:";l
  72. print
  73. if limb exist(1, l)=1
  74.     print "limb offset x = ";limb offset x(1, l)
  75.     print "limb offset y = ";limb offset y(1, l)
  76.     print "limb offset z = ";limb offset z(1, l)
  77.     print "limb angle x = ";limb angle x(1, l)
  78.     print "limb angle y = ";limb angle y(1, l)
  79.     print "limb angle z = ";limb angle z(1, l)
  80.     print "limb position x = ";limb position x(1, l)
  81.     print "limb position y = ";limb position y(1, l)
  82.     print "limb position z = ";limb position z(1, l)
  83.     print "limb texture = ";limb texture(1, l)
  84.     print "limb visible = ";limb visible(1, l)
  85. endif
  86.  
  87. rem Wait for key press
  88. print
  89. print "Prss Any Key"
  90. suspend for key
  91.  
  92. Rem Complete next loop
  93. next l
  94.  
  95. rem Delete your object
  96. delete object 1
  97.  
  98. rem End the program
  99. end
  100.