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

  1. ;demo09-03.bb - Applying a grass texture
  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. texture=LoadTexture ("grass1.jpg")
  22. EntityTexture ground, texture
  23.  
  24.  
  25. ; This following code deals with cameras and terrain 
  26. While Not KeyDown(ESC_KEY)
  27.  
  28.     If KeyDown(RIGHT_KEY)=True Then TurnEntity camera,0,-1,0
  29.     If KeyDown(LEFT_KEY)=True Then TurnEntity camera,0,1,0
  30.     If KeyDown(DOWN_KEY)=True Then MoveEntity camera,0,0,-0.05
  31.     If KeyDown(UP_KEY)=True Then MoveEntity camera,0,0,0.05
  32.  
  33.     RenderWorld 
  34.     Flip
  35. Wend
  36. End