home *** CD-ROM | disk | FTP | other *** search
- ;demo11-07.bb - Explosssssionnnnnns
- ;_______________
-
-
- Graphics3D 640,480
- SetBuffer BackBuffer()
-
- ;Global particle variables
- Global particle=CreateSphere()
- Global particle1=CreateSphere()
- Global particle2=CreateSphere()
-
- ;Handle particles
- ScaleEntity particle, 0.2,0.2,0.2
- EntityColor particle, 235,125,23
-
- ScaleEntity particle1, 0.2,0.2,0.2
- EntityColor particle1, 125,125,125
-
- ScaleEntity particle2, 0.2,0.2,0.2
- EntityColor particle2, 235,1,234
-
-
- Const ESC_KEY = 1
- Const LEFT_KEY = 203
- Const RIGHT_KEY = 205
- Const UP_KEY = 200
- Const DOWN_KEY = 208
-
- ; Create camera
- camera=CreateCamera()
-
- ; Creating a light
-
- light=CreateLight()
-
- ; Creating the types
-
- type_player=1
- type_obstacle=2
-
- ; Creating a sphere
-
- sphere=CreateSphere()
- ScaleEntity sphere, 0.3,0.3,0.3
- PositionEntity sphere, -3,0,5
- EntityType sphere,type_player
- EntityRadius sphere, 0.2
-
-
- ; Creating a cone
- cone=CreateCone()
- PositionEntity cone, 3,0,5
- ScaleEntity cone, .8,.8,.8
- 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
-
- If CountCollisions (sphere)
- PositionEntity particle, EntityX(cone),EntityY(cone), EntityZ(cone)
- PositionEntity particle1, EntityX(cone),EntityY(cone), EntityZ(cone)
- PositionEntity particle2, EntityX(cone),EntityY(cone), EntityZ(cone)
- explosion=ready
- HideEntity cone
- End If
- If explosion=ready
- MoveEntity particle, -.3,.5,0
- MoveEntity particle1, +.5,.5,0
- MoveEntity particle2, .5,-.5,0
- End If
-
-
-
- MoveEntity sphere,x#,y#,z#
-
- UpdateWorld
- RenderWorld
-
- Flip
- Wend
-
- End