IF'S from hell

Blitz3D Forums/Blitz3D Programming/IF'S from hell

Remixed with less Ifs
	Local strafing = KeyDown(56) Or KeyDown(184) ;either ALT key
	Local running = KeyDown(42) Or KeyDown(54) ;either Shift key
	Local input_z = KeyDown(200) - KeyDown(208) ;up=+1, down=-1
	Local input_x = KeyDown(205) - KeyDown(203) ;right=+1, left=-1

	Local turn#
	If Not strafing Then
		turn = input_x * 2
		input_x = 0 ;remove sideways input so we can assume it's used for strafing hereafter
	EndIf

	Local running_z_speed_modifier# = 1.0
	If running Then running_z_speed_modifier = 3.0

	Local move_x# = input_x * .1
	Local move_z# = input_z * .1 * running_z_speed_modifier
	
	RotateEntity pcam,0,turn,0 ;turn to left or right
	MoveEntity pcam,move_x,0,move_z   ;go foward or back

Also, to solve your "double fast" problem, I'd normalize the movement vector to its largest dimension. This means that if move_z and move_x are .3 and .1, they'll be trimmed down to ~.285 and ~.095 respectively, creating a triangle with a hypotenuse length of .3.
	Local move_max# = max(Abs(move_z), Abs(move_x))
	If move_max > 0 Then
		Local hypot# = Sqr(move_z*move_z + move_x*move_x)
		move_z = move_z * move_max / hypot
		move_x = move_x * move_max / hypot
	EndIf

Function max#(a#, b#)
	If a>b Then Return a Else Return b
End Function