home *** CD-ROM | disk | FTP | other *** search
- ;demo13-01.bb - Gravity
- ;_______________
-
-
- camdistance=10
-
- Graphics3D 640,480
- SetBuffer BackBuffer()
-
- ;Key Constants
- Const ESC_KEY = 1
- Const LEFT_KEY = 203
- Const RIGHT_KEY = 205
- Const UP_KEY = 200
- Const DOWN_KEY = 208
- Const Z_KEY = 44
- Const A_KEY = 30
-
-
- ; Creating the types
- type_player=1
- type_ground=2
-
-
- ; Create camera
- camera=CreateCamera(pivot)
- PositionEntity camera, 15,0,1
-
- ; Creating a light
-
- light=CreateLight()
-
- ; Creating a terrain
-
- terrain=CreateTerrain(512)
- EntityColor terrain, 125,136,32
- PositionEntity terrain, -300,-1,-100
- EntityType terrain,type_ground
-
- ; Creating the sky
-
- sky=CreateSphere(32)
- ScaleEntity sky, 100,100,100
- EntityColor sky, 102,153,255
- FlipMesh sky
-
-
- ; Creating a sphere
-
- sphere=CreateSphere(64)
- PositionEntity sphere, 15,0,6
- EntityType sphere,type_player
- ScaleEntity sphere ,0.5,0.5,0.5
- EntityRadius sphere, 0.5
- 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
-
- ;Creating a pivot
-
- pivot=CreatePivot(sphere)
- MoveEntity pivot, 0,0,-camdistance
-
-
- ; This following code makes our program run
-
- Collisions type_player,type_ground,2,2
- Collisions type_ground,type_player,2,2
-
- 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 KeyDown(Z_KEY)=True Then z#=-0.1
- If KeyDown(A_KEY)=True Then z#=0.1
-
-
- MoveEntity sphere,x#,y#,z#
-
-
-
-
- UpdateWorld
-
- RenderWorld
-
- Flip
- Wend
-
- End