MoveObj (CMS)

From The Official Visionaire Studio: Adventure Game Engine Wiki
Revision as of 15:27, 15 August 2014 by AFRLme (talk) (Syntax Breakdown)
Name Type By
moveObj("obj", x, y, delay, easing) Definition AFRLme

This small function allows you to move an object from one position to another over x amount of time with specified easing.

Instructions

1. Add the main script to the Visionaire Studio Script Editor & set the script as a definition script.
2. To use this function you should create an execute a script action containing...

moveObj("object_name", 300, 450, 5000, easeQuintOut) -- move object_name to 350x450 over 5000 milliseconds with easeQuintOut

Main Script

function moveObj(obj, x, y, delay, easing)
 obj = getObject("Game.GameCurrentScene.SceneObjects[" .. obj .. "]")
 startObjectTween(obj, VObjectOffset, obj:getPoint(VObjectOffset), {x = x, y = y}, delay, easing)
end

Syntax Breakdown

Name Type Description
obj "string" This should be a "string" value containing the name of the object you want to affect.
x integer (number) This should be a an integer value of the x coordinate you want to move the object to.
y integer (number) This should be a an integer value of the y coordinate you want to move the object to.
delay integer (number) This should be a an integer value of the amount of time (milliseconds) it should take the object to get from a to b.
easing integer (number) This should contain the integer value or name of the easing you want to set.