All pastes #813605 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-12-12 17:34 UTC
rendered paste body
Function MoveTowards:Float(num:Float, dest:Float, speed:Float) 
	If num > dest Then
		num = num - speed
		If num < dest Then
			num = dest
		End If
	End If
	If num < dest Then
		num = num + speed
		If num > dest Then
			num = dest
		End If
	End If
	Return num
End Function

Function MoveTowardsAngle:Float(dir:Float, dest:Float, spd:Float) 
	If dir > dest
		If (dir - 180) < dest
			dir:-spd
		Else
			dir:+spd
		EndIf
		If dir < dest dir = dest
	Else If dir < dest
		If (dir + 180) < dest
			dir:-spd
		Else
			dir:+spd
		EndIf
		If dir > dest dir = dest
	EndIf
	Return dir
End Function