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

  1. ;demo09-01.bb - Beginning a terrain
  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. ; Create camera
  13. camera=CreateCamera()
  14. PositionEntity camera,0,1,0
  15.  
  16. ; Create a light
  17. light=CreateLight()
  18.  
  19. ; Create the terrain
  20. ground=CreateTerrain(512)
  21.  
  22.  
  23. ; This following code deals with cameras and terrain 
  24. While Not KeyDown(ESC_KEY)
  25.  
  26.     If KeyDown(RIGHT_KEY)=True Then TurnEntity camera,0,-1,0
  27.     If KeyDown(LEFT_KEY)=True Then TurnEntity camera,0,1,0
  28.     If KeyDown(DOWN_KEY)=True Then MoveEntity camera,0,0,-0.05
  29.     If KeyDown(UP_KEY)=True Then MoveEntity camera,0,0,0.05
  30.  
  31.     RenderWorld 
  32.     Flip
  33. Wend
  34. End