home *** CD-ROM | disk | FTP | other *** search
- ;demo11-04.bb - Collisions and types with ClearCollisions
- ; ------------------
- 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 SPACE_BAR = 57
- Const ONE_KEY = 2
- ; Creating the types
- type_player=1
- type_obstacle=2
-
- ;The camera
- camera=CreateCamera()
- ; Creating a light
- light=CreateLight()
- ; Creating a sphere
- sphere=CreateSphere()
- ScaleEntity sphere, 0.5,0.5,0.5
- PositionEntity sphere, -3,0,5
- EntityType sphere,type_player
- EntityRadius sphere, 0.2
-
- ; Creating a cone
- cone=CreateCone()
- PositionEntity cone, 1,0,5
- ScaleEntity cone, 1.5,1.5,1.5
- EntityType cone,type_obstacle
-
- Collisions type_player,type_obstacle,2,2
-
- ; This following code makes our program run
- While Not KeyDown(ESC_KEY)
- x#=0
- y#=0
- z#=0
- If KeyDown(LEFT_KEY)=True Then x#=-0.1
- If KeyDown(RIGHT_KEY)=True Then x#=0.1
- If KeyDown(DOWN_KEY)=True Then y#=-0.1
- If KeyDown(UP_KEY)=True Then y#=0.1
- MoveEntity sphere,x#,y#,z#
- While KeyHit( 57 )
- ClearCollisions
- Wend
- While KeyHit( 2)
- Collisions type_player,type_obstacle,2,2
- Wend
-
-
- RenderWorld
- UpdateWorld
- Flip
- Wend
- End