You almost got it there dude, here is a piece of code that is working as you want:
--constant you can modify local SPEED\_BALL = 10 local RADIUS\_BALL = 20 local STEP = 3 local TRAIL\_FADE\_DURATION = 500 local ball = display.newCircle(0, 0, RADIUS\_BALL) ball.vx = SPEED\_BALL ball.vy = SPEED\_BALL ball:setFillColor(1,0,0) local onUpdate = function(e) local A = {x = ball.x, y = ball.y}--previous position --move the ball ball.x = ball.x + ball.vx ball.y = ball.y + ball.vy local B = {x = ball.x, y = ball.y}--new position --get the distance local dx = B.x - A.x local dy = B.y - A.y local dist = math.sqrt(dx\*dx + dy\*dy) --draw trail particles local nbIterations = math.floor(dist / STEP) for i=0, nbIterations do local xx = A.x + i \* STEP \* dx/dist local yy = A.y + i \* STEP \* dy/dist local trailParticle = display.newCircle(xx, yy, RADIUS\_BALL) transition.to(trailParticle, {time = TRAIL\_FADE\_DURATION, alpha = 0, onComplete = function() trailParticle:removeSelf() end}) end --bounce on arena bounds if ball.x \> 320 then ball.x = 320 ball.vx = -ball.vx end if ball.x \< 0 then ball.x = 0 ball.vx = -ball.vx end if ball.y \> 480 then ball.y = 480 ball.vy = -ball.vy end if ball.y \< 0 then ball.y = 0 ball.vy = -ball.vy end --display ball over trail ball:toFront() end Runtime:addEventListener("enterFrame", onUpdate)