home *** CD-ROM | disk | FTP | other *** search
/ 3D Game Programming for Teens (2nd Edition) / 3DGPFT2E.iso / Source / Chapter11 / demo11-01.bb next >
Encoding:
Text File  |  2009-01-21  |  788 b   |  36 lines

  1. ;demo11-01.bb - Collisions
  2. ; ------------------
  3. Graphics3D 640,480 
  4. SetBuffer BackBuffer()
  5.  
  6. Const ESC_KEY = 1
  7. Const LEFT_KEY = 203
  8. Const RIGHT_KEY = 205
  9. Const UP_KEY = 200
  10. Const DOWN_KEY = 208
  11.  
  12. camera=CreateCamera()
  13. ; Creating a light
  14. light=CreateLight()
  15. ; Creating a sphere
  16. sphere=CreateSphere()
  17. ScaleEntity sphere, 0.5,0.5,0.5
  18. PositionEntity sphere, -3,0,5
  19. ; Creating a cone
  20. cone=CreateCone()
  21. PositionEntity cone, 1,0,5
  22. ScaleEntity cone, 1.5,1.5,1.5
  23. ; This following code makes our program run
  24. While Not KeyDown(ESC_KEY)
  25.     x#=0
  26.     y#=0
  27.     z#=0
  28.     If KeyDown(LEFT_KEY)=True Then x#=-0.1
  29.     If KeyDown(RIGHT_KEY)=True Then x#=0.1
  30.     If KeyDown(DOWN_KEY)=True Then y#=-0.1
  31.     If KeyDown(UP_KEY)=True Then y#=0.1
  32.     MoveEntity sphere,x#,y#,z#
  33.     RenderWorld
  34.     Flip
  35. Wend
  36. End