home *** CD-ROM | disk | FTP | other *** search
- ; demo12-03.bb - Panning sound
- ; _______________
-
- Graphics3D 640,480
- SetBuffer BackBuffer()
-
- Const ESC_KEY = 1
- Const LEFT_KEY = 203
- Const RIGHT_KEY = 205
-
- ; Creating a light
-
- light=CreateLight()
-
- ; Create camera
- camera=CreateCamera()
- PositionEntity camera, 0,1,0
-
- ; Creating a terrain
-
- ground=CreatePlane()
- EntityColor ground, 34,53,123
- EntityType ground,type_ground
-
- ; Create Sphere
-
- sphere=CreateSphere(64)
- PositionEntity sphere, 0,1,3
- EntityType sphere,type_player
- ScaleEntity sphere ,0.2,0.2,0.2
- EntityRadius sphere, 0.1
-
-
- Texture=CreateTexture(16,16): SetBuffer TextureBuffer(texture)
- ClsColor 12,35,36
- Cls
- Color 123,256,256
- Rect 0,0,8,8,1
- Rect 8,8,8,8,1
- ScaleTexture Texture,.2,.2
- EntityTexture sphere,texture
-
- ; Loading sound
- train = LoadSound ("train.wav")
-
-
- ; Running the program
-
- While Not KeyDown(ESC_KEY)
-
- x#=0
-
- If KeyDown(LEFT_KEY)=True Then x#=-0.1
- If KeyDown(RIGHT_KEY)=True Then x#=0.1
- If x# > 0
- pan# = 1
- Else
- pan# = -1
- EndIf
-
- If x# <> 0
- SoundPan train, pan#
- PlaySound train
- EndIf
- UpdateWorld
-
- MoveEntity sphere, x#,0,0
-
- RenderWorld
-
- Flip
- Wend
-
- End