| Heres the full sorce code: 
 
 
; A simple walk about with Grimly the DWARF
Type playerData
Field pmeshname$
Field pmesh ; entity handle for this mesh
Field Pname$
Field x#
Field y#
Field z#
Field yaw#
Field pitch#
Field roll#
Field speedx#
Field speedy#
Field speedz#
Field HP#
Field dam#
Field inventory[10] 
End Type 
; animation control codes
Const walk = 1
Const run  = 2
Const jump = 3
Const jumpat = 4
Const crouch = 5
Const battleidle = 6
Const battleidle1 = 7
Const attack = 8
Const jumpattack = 9
Const attack360 = 10
Const attack2swipe = 11
Const attackstab = 12
Const block = 13
Const fallforward = 14
Const fallbackward = 15
Const yes = 16
Const no = 17
Const idle = 18
Const idle1 = 19  ; default
;resolution
Const ScreenWidth = 1024
Const ScreenHeight = 768
;initialize player
Global p.playerdata = New playerData
Global camera,cam_pitch#,cam_yaw# 
; load up starting data
p\x# = 0.0
p\y# = 0.0
p\z# = 0.0
p\yaw# = 0.0
p\pitch# = 0.0
p\roll# = 0.0
p\HP = 100.0
p\dam# = 0.0
; give the mesh name
p\pmeshname$ = "models\dwarf1.b3d"
; init a 3d mode
Graphics3D ScreenWidth, ScreenHeight, 32, 1
MoveMouse 400,200 ; position mouse near center
;make a pivot for the camera
pivot = CreatePivot()
PositionEntity pivot, p\x,p\y+1.5,p\z 
;make camera
camera = CreateCamera( pivot )
CameraClsColor camera,100,100,100
PositionEntity camera,p\x,p\y+70,p\z-100
;setup lights
AmbientLight 190,190,190
Light2=CreateLight()
LightColor light2,120,120,220
RotateEntity light2, 0,90,0
PositionEntity light2, 40,20,0
light3=CreateLight()
LightColor light3,120,120,130
RotateEntity light3,0,0,0
PositionEntity light3, -400,20,0
; load terrain, mesh and animations
ter = LoadTerrain("terrain/ter1.bmp")
TerrainDetail ter,4000,True
ScaleMesh ter,100,0,100
PositionEntity ter,-50,0,-50
p\pmesh = LoadAnimMesh(p\pmeshname$, pivot)
;make a ground
plane = CreatePlane()
PositionEntity plane, 0, 0.1, 0
EntityAlpha plane, .5
mirror=CreateMirror
; make a box for a referance point
boxmesh = CreateMesh ()
boxmesh = CreateCube()
ScaleMesh boxmesh, 10,50,50
PositionEntity boxmesh, 5, 0, 200
;extract all sequances
AnimControl()
 
;Main Loop starts here:   Not no FPS control timer, yet.
While Not KeyHit(1)
	;
	; If the current animation has stopped, loop the idle animation.
	;
	If Not Animating( p\pmesh ) Then
		new_seq = idle1
		seq = new_seq
		Animate p\pmesh, 1, 0.2, seq, 0.8
	End If
	; clear turn flag
	p\yaw# = 0
	p\z# = 0
	
	;
	; Test keys.
	;
	moving=False
	If KeyDown( 203 ) Then
		p\yaw#=+1
		If seq <> jump Then
			new_seq = idle
		End If
		moving=True
	EndIf
	If KeyDown( 205 )  Then 
		p\yaw#=-1
		If seq <> jump Then
			new_seq = idle
		End If
		moving=True
	EndIf 
	If KeyDown( 208 ) Then 
		p\z#=-0.4
		If seq <> jump Then
			new_seq = walk
		End If
		moving=True
	EndIf
	If KeyDown( 200 ) Then
	  	p\z#=+0.4
		If seq <> jump Then
			new_seq = walk
		End If
		moving=True
	EndIf 
	If KeyDown( 57 ) Then
		If seq <> jump Then
			new_seq = jump
		End If
		moving=True
	EndIf
	;
	; If the player is not moving, switch back to
	; the idle animation...
	;
	If Not moving Then
		If seq <> jump Then
			new_seq=idle1
		End If
	End If
	;
	; Start playing a new animation sequence?
	;
	If seq <> new_seq Then
		seq = new_seq
		Animate p\pmesh, 3, 0.4, seq, 0.8
	End If
	
	;Animate p\pmesh,1,.2,seq
	ScaleEntity p\pmesh, .02, .02, .02
	TurnEntity pivot, p\pitch#, p\yaw#, p\roll#
	PointEntity camera, p\pmesh
	MoveEntity pivot, p\x#,p\y#,p\z#
	PositionEntity boxmesh, 5, 50, 200
	
	mouselook()
	UpdateWorld
	RenderWorld
	Flip
Wend
End
; uses constants list above to select animation by
; name, much easier to use than just numbers.
Function  AnimControl()
			ExtractAnimSeq p\pmesh, 2, 14  ;walk
			ExtractAnimSeq p\pmesh, 16, 26  ;run
			ExtractAnimSeq p\pmesh, 28, 40  ;jump 1
			ExtractAnimSeq p\pmesh, 42, 54  ;jump 2 - for user controlled jumps
			ExtractAnimSeq p\pmesh, 56, 74  ;crouch - 56-59=down, 60-69=crouch, 70-74=get up
			ExtractAnimSeq p\pmesh, 75, 88  ;battle idle 1
			ExtractAnimSeq p\pmesh, 90, 110 ;battle idle 1
			ExtractAnimSeq p\pmesh, 112, 126  ;Attack 1 - swing
			ExtractAnimSeq p\pmesh, 128, 142  ;Attack 2 - Jump and overhead whack
			ExtractAnimSeq p\pmesh, 144, 160  ;Attack 3 - 360 backhand 
			ExtractAnimSeq p\pmesh, 162, 180  ;Attack 4 - 2 Swipes 
			ExtractAnimSeq p\pmesh, 182, 192  ;Attack 5 - Stab
			ExtractAnimSeq p\pmesh, 194, 210  ;Attack 6 - BLOCK
			ExtractAnimSeq p\pmesh, 212, 227  ;Die 1 - Forwards
			ExtractAnimSeq p\pmesh, 230, 251	;Die 1 - Backwards
			ExtractAnimSeq p\pmesh, 253, 272	;Nod YES
			ExtractAnimSeq p\pmesh, 274, 290	;Shake head NO
			ExtractAnimSeq p\pmesh, 292, 325	;Idle 1
			ExtractAnimSeq p\pmesh, 327, 360	;Idle 2
End Function
Function MoveControl()
End Function
Function mouselook()
	; Mouse look
	; ----------
	; Mouse x and y speed
	mxs=MouseXSpeed()
	mys=MouseYSpeed()
	
	; Mouse shake (total mouse movement)
	mouse_shake=Abs(((mxs+mys)/2)/1000.0)
	; Destination camera angle x and y values
	dest_cam_yaw#=dest_cam_yaw#-mxs
	dest_cam_pitch#=dest_cam_pitch#+mys
	; Current camera angle x and y values
	cam_yaw=cam_yaw+((dest_cam_yaw-cam_yaw)/5)
	cam_pitch=cam_pitch+((dest_cam_pitch-cam_pitch)/5)
	
	RotateEntity camera,cam_pitch#,cam_yaw#,0
	;RotateEntity camera,mxs,mys,0
		
	; Rest mouse position to centre of screen
	MoveMouse 400,300
		; Move camera using movement values
	MoveEntity camera,x#,y#,z#
		
End Function	
 
 |