I have some basic code which would run instantly but I would need it to yield before restarting the loop.
MapGroup = display.newGroup() frameN = 0 function DrawPath() somerandomoffset = math.random(5,10) display.newRect(MapGroup,frameN\*20,25,20,50+somerandomoffset) display.newRect(MapGroup,frameN\*20,display.actualContentHeight-25,20,50+somerandomoffset) frameN = frameN + 1 end for i = 1,30 do -- draws the start DrawPath() end while frameN \< 500 do -- just to prevent a crash but it would normally be while true do for i = 1, 5 do -- moves the map 20 pixels and draws a new column MapGroup.x = MapGroup.x - 4 -- this should work I believe to scroll the map --Needs a way to yield right here for x miliseconds end DrawPath() print(frameN) end
I’ve looked up and could not find any sleep function other than a function which creates a seperate thread to run a function x miliseconds later
the goal was to create a scrolling display.