0 Members and 1 Guest are viewing this topic.
global_flags = {is_paused = nil}setupBeginNoBreakPause = function(milliseconds) global_flags.is_paused = timer.start(milliseconds/1000)end -- all events are surrounded with a limited that doesn't allow anything to happen while the flag is setfunction on.timer if global_flags.is_paused global_flags.is_paused = nil endend
If that's really an equilateral triangle, shouldn't the square root of 3 be involved somehow?
function drawTriangle(gc,x,y,l) gc:drawLine(x,y,x+l,y) gc:drawLine(x, y, x+(l/2), y+(l*math.sin(60))) gc:drawLine(x+(l/2), y+(l*math.sin(60)), x+l, y)end
Pause for an exact amount of time, in millisecondsCode: [Select]WaitMS = function(milliseconds) while (stime = math.abs(timer.GetMilliSecCounter()+milliseconds))< math.abs(timer.getMilliSecCounter()) do end return trueend
WaitMS = function(milliseconds) while (stime = math.abs(timer.GetMilliSecCounter()+milliseconds))< math.abs(timer.getMilliSecCounter()) do end return trueend
Code: [Select]global_flags = {is_paused = nil}setupBeginNoBreakPause = function(milliseconds) global_flags.is_paused = timer.start(milliseconds/1000)end -- all events are surrounded with a limited that doesn't allow anything to happen while the flag is setfunction on.timer if global_flags.is_paused global_flags.is_paused = nil endend
Don't use that one. Use a custom-made implementation of this that fits your application-specific needs instead:Quote from: Ashbad on June 22, 2011, 08:57:36 amCode: [Select]global_flags = {is_paused = nil}setupBeginNoBreakPause = function(milliseconds) global_flags.is_paused = timer.start(milliseconds/1000)end -- all events are surrounded with a limited that doesn't allow anything to happen while the flag is setfunction on.timer if global_flags.is_paused global_flags.is_paused = nil endend
Simply inside of all your events, make it so once the global flag is set to a non-nil value, the event execution ends and don't allow them to be triggered by starting all code within the blocks with a "if global_flags.is_paused ~= nil" checker. Simple as that
function setGrey(shade) gc:setColorRGB((shade*255)/16,(shade*255)/16,(shade*255)/16)end
function setGrey(shade) platform.gc():setColorRGB((shade*255)/16,(shade*255)/16,(shade*255)/16)end
function setGrey(gc, shade) gc:setColorRGB((shade*255)/16,(shade*255)/16,(shade*255)/16)end
I am a proud cynic.