Explain object:translate() ?

Hey guys,

Can someone explain what object:translate actually does? Hopefully with a simple example :smiley: [import]uid: 75783 topic_id: 13857 reply_id: 313857[/import]

http://developer.anscamobile.com/reference/index/objecttranslate [import]uid: 16142 topic_id: 13857 reply_id: 50916[/import]

its simple. it adds deltaX and deltaY to the x and y properties.

Syntax:
object:translate( deltaX, deltaY )

see the eg below
[lua]local img = display.newRect(100,100,40,40)

local function translateIMG()
img:translate( 50, 50 )
end

img:addEventListener(β€œtap”,translateIMG)
[lua]the rectangle is at position 100,100. on the click event of that rectangle we translate it with deltaX 50 and deltaY50. so the object just change its position to x = 150, y = 150
hope its clear. :slight_smile: [import]uid: 71210 topic_id: 13857 reply_id: 50933[/import]