home *** CD-ROM | disk | FTP | other *** search
- ;demo12-01.bb - Playing Sounds
- ; ------------------
- Graphics3D 640,480
- SetBuffer BackBuffer()
-
- Const ESC_KEY = 1
- Const LEFT_KEY = 203
- Const RIGHT_KEY = 205
- Const UP_KEY = 200
- Const DOWN_KEY = 208
- Const A_KEY = 30
- Const Z_KEY = 44
-
- ; Creating the types
- type_player=1
- type_ground=2
- type_enemy=3
-
- ;Load the sound
- blaster = LoadSound ("blaster.wav")
- ; 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
-
- ; Create Cube
-
- cube=CreateCube()
- PositionEntity cube, -2,1,3
- ScaleEntity cube, 0.2,0.2,0.2
- EntityType cube, type_enemy
-
- ; This following code makes our program run
-
- Collisions type_player,type_ground,2,2
- Collisions type_ground,type_player,2,2
- Collisions type_player,type_enemy,2,2
-
- While Not KeyDown(ESC_KEY)
- x#=0
- y#=0
- z#=0
-
- If KeyDown(LEFT_KEY)=True Then x#=-0.05
- If KeyDown(RIGHT_KEY)=True Then x#=0.05
- If KeyDown(DOWN_KEY)=True Then y#=-0.05
- If KeyDown(UP_KEY)=True Then y#=0.05
- If KeyDown(Z_KEY)=True Then z#=-0.05
- If KeyDown(A_KEY)=True Then z#=0.05
- MoveEntity sphere,x#,y#,z#
- ; Collision Sound
- If CountCollisions (sphere)
- PlaySound blaster
- EndIf
-
-
-
- UpdateWorld
- RenderWorld
- Flip
- Wend
- End