Load3DSound.bb 1010 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. ; Load3DSound Example
  2. ; -------------------
  3. Graphics3D 640,480
  4. SetBuffer BackBuffer()
  5. camera=CreateCamera()
  6. PositionEntity camera,0,1,-10
  7. light=CreateLight()
  8. RotateEntity light,90,0,0
  9. plane=CreatePlane()
  10. ground_tex=LoadTexture("media/Chorme-2.bmp")
  11. EntityTexture plane,ground_tex
  12. cube=CreateCube()
  13. cube_tex=LoadTexture("media/b3dlogo.jpg")
  14. EntityTexture cube,cube_tex
  15. PositionEntity cube,0,1,0
  16. microphone=CreateListener(camera) ; Create listener, make it child of camera
  17. sound=Load3DSound("media/ufo.wav") ; Load 3D sound
  18. While Not KeyDown(1)
  19. If KeyDown(205)=True Then TurnEntity camera,0,-1,0
  20. If KeyDown(203)=True Then TurnEntity camera,0,1,0
  21. If KeyDown(208)=True Then MoveEntity camera,0,0,-0.05
  22. If KeyDown(200)=True Then MoveEntity camera,0,0,0.05
  23. ; If left mouse button hit then emit sound from cube
  24. If MouseHit(1) = True Then EmitSound(sound,cube)
  25. RenderWorld
  26. Text 0,0,"Use cursor keys to move about"
  27. Text 0,20,"Press left mouse button to make a sound be emitted from the cube"
  28. Flip
  29. Wend
  30. End