Need help with player movement !

Blitz3D Forums/Blitz3D Programming/Need help with player movement !

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.

I'd think merely checking the terrainY against the players position would tell you whether or not he's in the air or on the ground. Providing that's how you're controlling where he walks. Something similar as this.


While Not KeyHit(1)
If KeyDown(200) Then
MoveEntity player,0,0,.5 
EndIf
If KeyDown(208) Then
MoveEntity player,0,0,-.5 
EndIf
If KeyDown(203) Then
TurnEntity player ,0,2,0 
EndIf
If KeyDown(205) Then
TurnEntity player ,0,-2,0 
EndIf
x#=EntityX(camera)
y#=EntityY(camera)
z#=EntityZ(camera)
x1#=EntityX(player)
y1#=EntityY(player)
z1#=EntityZ(player)
terra_y#=TerrainY(terrain1,x#,y#,z#)+5
PositionEntity camera,x#,terra_y#+15,z#
If Not EntityCollided(player,2)
PositionEntity player,x1#,terra_y#+3,z1#
End If
If Not KeyDown(200) Or KeyDown(208)
AnimateMD2 player,1,0.5,20,25 :UpdateWorld
EndIf
MouseLook(camera)
UpdateWorld
RenderWorld
Flip
Wend


Doggie