Game Development Community

Scripting question - getPosition

by Joe Spataro · in Torque Game Builder · 03/21/2005 (3:59 pm) · 2 replies

Hello,

when I call

%pos = %obj.getPosition();

how do I access the x and y components?

is it %pos.x? %pos[0]?

thanks.
joe.s

#1
03/21/2005 (4:17 pm)
This is what I used to get the x and y components:


%currentPosition = $thing.getPosition();
%currentPositionX = getWord(%currentPosition, 0);
%currentPositionY = getWord(%currentPosition, 1);
#2
03/21/2005 (9:40 pm)
Just thought I'd mention that the update will include some additional helpers for stuff like this so expect...

getPositionX()
getPositionY()
getSizeX()
getSizeY();
setPositionX()
setPositionY()
setSizeX()
setSizeY();

... and more.

- Melv.