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

  1. ;demo13-08.bb - Weapon
  2. ;_______________
  3.  
  4. Graphics3D 640,480
  5. SetBuffer BackBuffer()
  6.  
  7. Const ESC_KEY = 1
  8. Const UP_KEY = 200
  9. Const DOWN_KEY = 208
  10. Const LEFT_KEY = 203
  11. Const RIGHT_KEY = 205
  12.  
  13. ; Create camera
  14. camera=CreateCamera()
  15. PositionEntity camera, 50,1,50
  16. TurnEntity camera, 0,50,0
  17.  
  18. ; Creating a light
  19.  
  20. light=CreateLight()
  21.  
  22. ; Creating the terrain
  23. ground=CreateTerrain(512)
  24. PositionEntity ground, -500,0,-500
  25. ScaleEntity ground, 10,15,10
  26. tex=LoadTexture( "grass1.jpg" )
  27. EntityTexture ground, tex
  28.  
  29. ;Creating the sky
  30.  
  31. sky = CreateSphere (60)
  32. FlipMesh sky
  33. ScaleEntity sky, 500,500,500
  34. PositionEntity sky, 0,50,0
  35. sky_tex = LoadTexture ( "sky.jpg" )
  36. EntityTexture sky,sky_tex
  37.  
  38.  
  39. ; This following code makes our program run
  40.  
  41. While Not KeyDown(ESC_KEY)
  42.  
  43.     If KeyDown(RIGHT_KEY)=True Then TurnEntity camera,0,-1,0
  44.     If KeyDown(LEFT_KEY)=True Then TurnEntity camera,0,1,0
  45.     If KeyDown(DOWN_KEY)=True Then MoveEntity camera,0,0,-0.05
  46.     If KeyDown(UP_KEY)=True Then MoveEntity camera,0,0,0.05
  47.     
  48.     RenderWorld
  49.     
  50.     Flip
  51. Wend
  52. End