Function OnTimer

function OnTimer()
	...
end function

This is an event function you can overload to perform some repeating actions. This event is fired more than 30 times per second. The time intervals between calls may vary depending on a system, but the timer is very accurate and the intervals are virtually identical. This is the perfect place for redrawing scenes in a game. Example:

$Pony = #"pony.png"
$nStartTime = GetTime ()

function OnTimer()
	ClearScreen()
	' speed is 10 points per second
	x = (GetTime () - $nStartTime) / 100
	nWidth = GetWidth()
	x = x - int(x/nWidth)*nWidth
	DrawImage(x, 100, $Pony)
end function

See also: