object:translate()

Type Function
Object DisplayObject
Library display.*
Return value none
Revision 2017.3122
Keywords translate, x, y, positioning
See also object.x
object.y

Overview

Effectively adds values to the object.x and object.y properties of an object, thus changing its screen position.

Syntax

object:translate( deltaX, deltaY )
deltaX, deltaY (required)

Numbers. Amount to add to the object's x and y properties respectively.

Gotchas

This cannot be used on a physical body during a collision event. However, your collision handler may set a flag or include a time delay via timer.performWithDelay() so that the action can occur in the next application cycle or later. See the Collision Detection guide for a complete list of which APIs and methods are subject to this rule.