Hi there!
Easy code to implement a shake using a transition!
local square = display.newRect(768,1024,100,100) local shakeEasing = function(currentTime, duration, startValue, targetDelta) local shakeAmplitude = 100 -- maximum shake in pixels, at start of shake local timeFactor = (duration-currentTime)/duration -- goes from 1 to 0 during the transition local scaledShake =( timeFactor\*shakeAmplitude)+1 -- adding 1 prevents scaledShake from being less then 1 which would throw an error in the random code in the next line local randomShake = math.random(scaledShake) return startValue + randomShake - scaledShake\*0.5 -- the last part detracts half the possible max shake value so the shake is "symmetrical" instead of always being added at the same side end -- shakeEasing transition.to(square, {time = 1000, x = square.x, y = square.y, transition = shakeEasing}) -- use the displayObjects current x and y as parameter