my fisrt project

Blitz3D Forums/Blitz3D Beginners Area/my fisrt project

;Name of application
AppTitle "My First Terrain And First animated Character"

;*******************
;GRAPHICS
;*******************

Graphics3D 800,600,16,1

SetBuffer BackBuffer()

Camera=CreateCamera()

PositionEntity camera,30,1,2,True

Light=CreateLight()

RotateEntity Light,90,0,0

terrain=LoadMesh("terrain1.x")

PositionEntity terrain,0,0,5

RotateEntity terrain,0,20,0

TranslateEntity terrain,30,0,-.15

Grass=LoadTexture("grass2.bmp")
EntityTexture terrain,Grass

box=LoadAnimMesh("model\BOX.B3D")

ScaleEntity box,.1,.1,.1

PositionEntity box,0,0,5

TranslateEntity box,30,0,-.15

SetAnimKey box,15,True,True,True

AddAnimSeq(box,15)

Animate box,1,2,0,100

;Set Collision values
type_box=1
type_terrain=2

;Set Box radius values
box_radius#=1

EntityType box,type_box
EntityType terrain,type_terrain

Collisions type_box,type_terrain,2,2

Dither True

While Not KeyHit(88) ;press F12 To Exit

X#=0
Y#=0
Z#=0

;this moves and turn's the box around

player=CreatePivot()
EntityParent(camera,box,1)

If KeyHit(87)=True Then enable=1-enable

WireFrame enable

MoveEntity box,X#,Y#,Z#

If KeyDown( 32 )=True Then TurnEntity camera,0,-.0,0
If KeyDown( 30 )=True Then TurnEntity camera,0,.0,0
If KeyDown( 31 )=True Then MoveEntity camera,0,0,-0.00
If KeyDown( 17 )=True Then MoveEntity camera,0,0,0.00


If KeyDown( 32 )=True Then TurnEntity box,0,-1,0
If KeyDown( 30 )=True Then TurnEntity box,0,1,0
If KeyDown( 31 )=True Then MoveEntity box,0,0,-0.05
If KeyDown( 17 )=True Then MoveEntity box,0,0,0.05

EntityRadius box,box_radius#

EntityRadius terrain,terrain_radius#

UpdateWorld
RenderWorld tween

Flip

Wend

FreeEntity(box)

FreeEntity(terrain)

ClearWorld(box,terrain,Grass )


End