home *** CD-ROM | disk | FTP | other *** search
/ 3D Game Programming for Teens (2nd Edition) / 3DGPFT2E.iso / Source / Chapter13 / demo13-06.bb < prev    next >
Encoding:
Text File  |  2009-01-21  |  1.0 KB  |  64 lines

  1. ;demo13-06.bb - Text!
  2. ;_______________
  3.  
  4.  
  5. Graphics3D 640,480
  6. SetBuffer BackBuffer()
  7.  
  8. Const ESC_KEY = 1
  9. Const UP_KEY = 200
  10. Const DOWN_KEY = 208
  11. Const LEFT_KEY = 203
  12. Const RIGHT_KEY = 205
  13.  
  14. ; Creating the types
  15.  
  16. type_player=1
  17. type_obstacle=2
  18.  
  19. ; Create camera
  20. camera=CreateCamera()
  21.  
  22. ; Creating a light
  23.  
  24. light=CreateLight()
  25.  
  26. ; Creating a sphere
  27.  
  28. sphere=CreateSphere()
  29. ScaleEntity sphere, 0.5,0.5,0.5
  30. PositionEntity sphere, -3,0,5
  31. EntityType sphere,type_player
  32. EntityRadius sphere, 0.2
  33.  
  34. ; Creating a cone
  35.  
  36. cone=CreateCone()
  37. PositionEntity cone, 1,0,5
  38. ScaleEntity cone, 1.5,1.5,1.5
  39. EntityType cone, type_obstacle
  40.  
  41. Collisions type_player,type_obstacle,2,2
  42.  
  43. ; This following code makes our program run
  44.  
  45. While Not KeyDown(ESC_KEY)
  46.  
  47.     x#=0
  48.     y#=0
  49.     z#=0
  50.     
  51.     If KeyDown(LEFT_KEY)=True Then x#=-0.1
  52.     If KeyDown(RIGHT_KEY)=True Then x#=0.1
  53.     If KeyDown(DOWN_KEY)=True Then y#=-0.1
  54.     If KeyDown(UP_KEY)=True Then y#=0.1
  55.     
  56.     MoveEntity sphere,x#,y#,z#
  57.     
  58.     UpdateWorld
  59.     RenderWorld
  60.     
  61.     Flip
  62. Wend
  63.  
  64. End