home *** CD-ROM | disk | FTP | other *** search
- ;demo13-04.bb - A chase camera!
- ;_______________
-
-
- camdistance=10
-
- Graphics3D 640,480
- SetBuffer BackBuffer()
-
- ;Key Constants
- Const ESC_KEY = 1
- Const UP_KEY = 200
- Const DOWN_KEY = 208
- Const LEFT_KEY = 203
- Const RIGHT_KEY = 205
- Const S_KEY = 31
-
-
- ; Creating the types
-
- type_player=1
- type_ground=2
-
-
- ; Create camera
- camera=CreateCamera()
-
-
- ; Creating a light
-
- light=CreateLight()
-
- ;Create a texture
- grid_tex=CreateTexture( 32,32,8 )
- ScaleTexture grid_tex,10,10
- SetBuffer TextureBuffer( grid_tex )
- Color 0,0,64:Rect 0,0,32,32
- Color 0,0,255:Rect 0,0,32,32,False
- SetBuffer BackBuffer()
-
- ;Set up texture
- grid_plane=CreatePlane()
- EntityTexture grid_plane,grid_tex
- EntityBlend grid_plane,1
- EntityAlpha grid_plane,.6
- EntityFX grid_plane,1
- EntityType grid_plane, type_ground
- PositionEntity grid_plane, 0,-1,0
-
- ; Creating a cone
-
- cone=CreateCone(64)
- EntityType cone,type_player
- PositionEntity cone, 0,1,5
- ScaleEntity cone ,0.4,0.4,0.4
- EntityRadius cone, 0.5
- Texture=CreateTexture(16,16): SetBuffer TextureBuffer(texture)
- ClsColor 256,6,56
- Cls
- Color 12,126,256
- Rect 0,0,8,8,1
- Rect 8,8,8,8,1
- ScaleTexture Texture,.2,.2
- EntityTexture cone,texture
-
- ; This following code makes our program run
-
- While Not KeyDown(ESC_KEY)
-
-
- If KeyDown(DOWN_KEY)=True Then velocity#=velocity#-0.001
- If KeyDown(UP_KEY)=True Then velocity#=velocity#+0.001
- If KeyDown (S_KEY) Then velocity#=0
- If KeyDown (S_KEY) Then xvelocity#=0
- If KeyDown(LEFT_KEY)=True Then xvelocity#=xvelocity#-0.001
- If KeyDown(RIGHT_KEY)=True Then xvelocity#=xvelocity#+0.001
-
-
- MoveEntity cone,xvelocity#,0,velocity#
- TranslateEntity cone, 0,-0.03,0
-
- Collisions type_player,type_ground,2,2
- Collisions type_ground,type_player,2,2
-
- UpdateWorld
- RenderWorld
- Flip
- Wend
-
- End
-
-