my fisrt project

Blitz3D Forums/Blitz3D Beginners Area/my fisrt project

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Your code, corrected: (use this instead of your old code)
;Name of application
AppTitle "My First Terrain And First animated Character"

;Initialise Graphics mode
Graphics3D 800,600,16,1
SetBuffer BackBuffer()

;Camera has to be set, so the scene is visible
Camera=CreateCamera()
PositionEntity camera,30,1,2,True 

;Light The Scene, so that it doesn't look flat
Light=CreateLight()
RotateEntity Light,90,0,0

;Create the "Terrain" Entity...
terrain=LoadMesh("terrain1.x")
PositionEntity terrain,0,0,5
RotateEntity terrain,0,20,0 
TranslateEntity terrain,30,0,-.15 
;...and texture it
Grass=LoadTexture("grass2.bmp")
EntityTexture terrain,Grass

;Create the "Box" entity and animate it
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 types fot the "collisions" command 1-player, 2-ground
type_box=1
type_terrain=2
EntityType box,type_box
EntityType terrain,type_terrain

;Adjust Radius of Sphere, that's used for Sphere-Polygon collisions
box_radius#=1
EntityRadius box, box_radius

;Initialise Collisions between player and ground
Collisions type_box,type_terrain,2,2 

;Dither scene, so that it does look good with 16 Bit Color-Depth
Dither True 

;Main Loop
While Not KeyHit(88) ;press F12 To Exit
  
  ;Press F11 to see the world in Wireframe mode
  If KeyHit(87)=True Then enable=1-enable 
  WireFrame enable 
  
  ;Parent the player to the camera, so that moving the player makes the camera follow it
  EntityParent(camera,box,1)

  ;Keyboard input (cursor-keys) for moving the player around
  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

  ;Update the animation-Frames and Render the calculated scene, Flip Back- with Frontbuffer after that, so the new frame becomes visible
  UpdateWorld
  RenderWorld
  Flip 

Wend

;Free the Memory and end the program
ClearWorld
End