GD Resources logo

Moving Objects #

OmgRod avatar
Written by:
OmgRod
Owner

Lua Trigger lets you interact with objects through group IDs. One of the ways you can interact with objects is by moving them. An example of how to move objects is below:

lua
1while true do
2 Object.move(
3 1, -- All objects in group ID 1
4 30, -- Moves object 30 units (1 block) to the right
5 30, -- Moves object 30 units (1 block) up
6 1 -- Over 1 second
7 )
8 wait(1) -- Waits 1 second (look at wait docs)
9end

The code above moves all the objects in group ID 1 30 units up and 30 units right over the duration of 1 second.

Object.move() parameters
ParameterTypeDefaultDescription
Group IDnumber-The Target Group ID of the objects you want to move.
Move Xnumber-Horizontal distance to move in units (30 units = 1 block). Positive moves right, negative moves left.
Move Ynumber-Vertical distance to move in units (30 units = 1 block). Positive moves up, negative moves down.
Durationnumber0The time in seconds over which the movement takes place.
easingTypenumber0Easing type (look at easing type docs).
easingRatenumber2Easing rate (look at easing rate docs).