home *** CD-ROM | disk | FTP | other *** search
/ 3D Game Programming for Teens (2nd Edition) / 3DGPFT2E.iso / Source / Chapter13 / demo13-07.bb < prev    next >
Text File  |  2009-01-20  |  1KB  |  56 lines

  1. ;demo13-07.bb -  Out of Order Traffic Light
  2. ;_______________________
  3.  
  4.  
  5. Graphics3D 640,480
  6. SetBuffer BackBuffer()
  7.  
  8.  
  9. ; Create camera
  10. camera=CreateCamera()
  11.  
  12. ;Create light
  13. light=CreateLight()
  14.  
  15. ;Create a cube 
  16.  
  17. cube=CreateCube()
  18. ScaleEntity cube, 0.7,1.7,1
  19. PositionEntity cube, 0,0,5
  20. EntityColor cube, 234,234,23
  21.  
  22. ;Create red light
  23.  
  24. red=CreateSphere()
  25. PositionEntity red, 0,1.2,4.9
  26. ScaleEntity red, 0.5,0.5,0.5
  27. EntityOrder red,-1
  28.  
  29. ;Create yellow light
  30.  
  31. yellow=CreateSphere()
  32. PositionEntity yellow, 0,0,4.9
  33. ScaleEntity yellow, 0.5,0.5,0.5
  34. EntityOrder yellow,-1
  35.  
  36. ;Create green light
  37.  
  38. green=CreateSphere()
  39. PositionEntity green, 0,-1.2,4.9
  40. ScaleEntity green, 0.5,0.5,0.5
  41. EntityOrder green,-1
  42.  
  43. ;The following code makes our program run
  44.  
  45. While Not KeyDown( 1 )
  46.  
  47. EntityColor red, Rand(177,255),Rand(0,110),Rand(0,87)
  48.  
  49. EntityColor yellow, Rand(236,255),Rand(193,255),Rand(0,85)
  50.  
  51. EntityColor green, Rand(0,113),Rand(193,255),Rand(0,120)
  52.  
  53. RenderWorld
  54. Flip
  55. Wend
  56. End