Pretty simple; I have a display object I need to visually / violently shake on-screen for a small length of time. The easiest thing that comes to mind is a recursively timed function, that is…
[code]local time = 1
local object = display.newRect(0, 0, 100, 100)
local shakeThis = function()
if time < 500 then
local shakeX, shakeY = math.random(5), math.random(5) – generate random delta
object:translate( shakeX, shakeY) – move to delta
time = time + 1 – increment counter
timer.performWithDelay(50, shakeThis) – perform again in 50ms
end
end[/code]
Not the most polished function, I know, but the end result just performs once and then moves on. The timer gets killed and that’s it. I tried using [lua]while[/lua] instead of if, which will increment time gladly…but the screen never bothers to update after the initial shakeX/shakeY calculation.
Ideas? I’m probably missing something fundamental about corona… [import]uid: 41884 topic_id: 21707 reply_id: 321707[/import]

But if you read carefully, I do manage to trigger the function. It’s just that despite the function starting, I can’t get it to do what it seemingly should be capable of.