exiting animation loop

Blitz3D Forums/Blitz3D Programming/exiting animation loop

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.

Ruz,

I raped and pillaged the castle demo. Well, pillage anyway.
Check near the middle.
Does this help?


Function UpdatePlayer( p.Player )
	If KeyHit(56)	;fire?
		CreateBullet( p )
	EndIf
	
	If KeyDown(203)	;left/right
		TurnEntity p\entity,0,6,0	;turn player left/right
	Else If KeyDown(205)
		TurnEntity p\entity,0,-6,0
	EndIf
	
	If KeyDown(30)		;forward
		If p\anim_speed<=0
			p\anim_speed=1.75
			Animate p\model,1,p\anim_speed
		EndIf
		MoveEntity p\entity,0,0,1
	Else If KeyDown(44)	;back
		If p\anim_speed>=0
			p\anim_speed=-1.75
			Animate p\model,1,p\anim_speed
		EndIf
		MoveEntity p\entity,0,0,-1
	Else If p\anim_speed	;stop animating
		p\anim_speed=0
		Animate p\model,0
	EndIf

	Goto skip	
	ex#=EntityX(p\entity):ez#=EntityZ(p\entity)
	PositionEntity p\entity,ex,TerrainY( land,ex,0,ez )+1.5,ez
	Return
	.skip
	
	ty#=EntityY(p\entity)
	y_vel#=(ty-p\player_y)
	p\player_y=ty
	
	If KeyHit(57)	;jump?
		y_vel=5	;2.4
	Else
		y_vel=y_vel-.5	;2
	EndIf
	TranslateEntity p\entity,0,y_vel,0
	
End Function