Newbie here…
I am trying to make a random delta time transition where columns are transitioning down from the screen.
I’ve tried to use this code below which uses timer.performWithDelay but when I tested it on a device it keeps glitching and the columns come down at different rate so that’s why I thought about using delta time. So how can I change the code from timer.performWithDelay to delta time but at the same time keeping the random columns coming down.
function slidemove(event) if event.phase == "began" then if gameStarted == false then player.bodyType = "dynamic" instructions.alpha = 0 tb.alpha = 1 addColumnTimer = timer.performWithDelay(925, addColumns, -1) moveColumnTimer = timer.performWithDelay(1.85, moveColumns, -1) gameStarted = true end end end function moveColumns() for a = elements.numChildren,1,-1 do if(elements[a].y \>= display.contentCenterY) then if elements[a].scoreAdded == false then mydata.score = mydata.score + 1 tb.text = mydata.score elements[a].scoreAdded = true end end if(elements[a].y \> -100) then elements[a].y = elements[a].y + 12 else elements:remove(elements[a]) end end end function addColumns() height = math.random(display.contentCenterX - 300, display.contentCenterX + 300) topColumn = display.newRect(0,0,714,64) topColumn:setFillColor(100/255,203/255,219/255) topColumn.anchorX = 1 topColumn.anchorY = 0.5 topColumn.x = height + 30 topColumn.y = display.contentWidth - 850 topColumn.scoreAdded = false physics.addBody(topColumn, "static", {density=1, bounce=0.1, friction=.2}) elements:insert(topColumn) bottomColumn = display.newRect(0,0,714,64) bottomColumn:setFillColor(0.9, 0.16, 0.78) bottomColumn.anchorX = 0 bottomColumn.anchorY = 0.5 bottomColumn.x = height + 100 bottomColumn.y = display.contentWidth - 850 physics.addBody(bottomColumn, "static", {density=0, bounce=0, friction=0}) elements:insert(bottomColumn) end