home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 63 / CDACTUAL63.iso / Aplicaciones / DarkBasic / DemoDarkBasic.exe / help / examples / basic3d / exam09.dba < prev    next >
Encoding:
Text File  |  1999-12-05  |  1.2 KB  |  46 lines

  1. Rem * Title  : Simple 3D maths
  2. Rem * Author : DBS-LB
  3. Rem * Date   : 1st Sept 99
  4. rem ==========================================
  5. rem DARK BASIC EXAMPLE PROGRAM 9
  6. rem ==========================================
  7. rem This program performs simple 3D maths
  8. rem ------------------------------------------
  9.  
  10. rem Load and animate your object (backdrop is auto-activated)
  11. load object "walk.x",1
  12. yrotate object 1,180
  13. fix object pivot 1
  14.  
  15. rem Activate manual sync
  16. sync on
  17.  
  18. rem Begin main loop
  19. while mouseclick()=0
  20.  
  21. rem Control variables with the cursor keys
  22. if upkey()=1 then dx#=newxvalue(dx#, angle#, 3.0) : dz#=newzvalue(dz#, angle#, 3.0)
  23. if downkey()=1 then dx#=newxvalue(dx#, angle#, -3.0) : dz#=newzvalue(dz#, angle#, -3.0)
  24. if leftkey()=1 then angle#=wrapvalue(angle#-10)
  25. if rightkey()=1 then angle#=wrapvalue(angle#+10)
  26.  
  27. rem You can curve values creating a smooth transition of position
  28. x#=curvevalue(dx#, x#, 10.0)
  29. z#=curvevalue(dz#, z#, 10.0)
  30.  
  31. rem You can curve angles creating smooth transition of rotation
  32. ca#=curveangle(angle#, ca#, 5.0)
  33.  
  34. rem Update the object with these new values
  35. position object 1,x#,0,z#
  36. yrotate object 1,ca#
  37.  
  38. rem Update Screen
  39. sync
  40.  
  41. rem End main loop
  42. endwhile
  43.  
  44. rem End the program
  45. end
  46.