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

  1. ;demo09-05.bb - Going inside a shape
  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 our Cube World
  20. cubeworld=CreateCube()
  21. FitMesh cubeworld,-250,0,-250,500,500,500
  22. FlipMesh cubeworld
  23. tex=LoadTexture( "wall.jpg" )
  24. ScaleTexture tex, 0.5,0.5
  25. EntityTexture cubeworld,tex
  26. EntityFX cubeworld,1
  27.  
  28.  
  29.  
  30. ; Create the terrain
  31. ground=CreateTerrain(512)
  32.  
  33.  
  34. ; This following code deals with cameras and terrain 
  35. While Not KeyDown(ESC_KEY)
  36.  
  37.     If KeyDown(RIGHT_KEY)=True Then TurnEntity camera,0,-1,0
  38.     If KeyDown(LEFT_KEY)=True Then TurnEntity camera,0,1,0
  39.     If KeyDown(DOWN_KEY)=True Then TurnEntity camera,-1,0,0
  40.     If KeyDown(UP_KEY)=True Then TurnEntity camera,1,0,0
  41.  
  42.     RenderWorld 
  43.     Flip
  44. Wend
  45. End