Set/getPositionX/Y problems
by Drew -Gaiiden- Sikora · in Torque Game Builder · 08/03/2005 (1:09 pm) · 4 replies
Even tho these four functions are in the T2D Reference, none of them seem to work :( I keep getting warnings in the console like
Unknown command setPositionX. Object (42521) fxAnimatedSprite2D -> fxSceneObject2D -> SimObjectthis kinda sucks since it makes the code for moving an object
%this.dropTarget.setPosition(getWord(%this.dropTarget.getPosition(), 0) - $BLOCK_SIZE SPC getWord(%this.dropTarget.getPosition(), 1));yuck. There should really be a movePosition and movePositionX/Y command so you don't have to reference the object's current position
#2
08/03/2005 (4:55 pm)
function fxSceneObject2D::movePosition(%this, %x, %y)
{
%pos = %this.getPosition();
%posX = getWord(%pos, 0);
%posY = getWord(%pos, 1);
%posX += %x;
%posY += %y;
%this.setPosition(%posX SPC %posY);
}
function fxSceneObject2D::movePositionX(%this, %x)
{
%pos = %this.getPosition();
%posX = getWord(%pos, 0);
%posY = getWord(%pos, 1);
%posX += %x;
%this.setPosition(%posX SPC %posY);
}
function fxSceneObject2D::movePositionY(%this, %y)
{
%pos = %this.getPosition();
%posX = getWord(%pos, 0);
%posY = getWord(%pos, 1);
%posY += %y;
%this.setPosition(%posX SPC %posY);
}
#3
Thx for those move functions anyways tho Matt. 'preciate it.
08/03/2005 (5:44 pm)
Quote:Well sure, but I wasn't asking for that. I just wanted to know whether these functions did indeed not work or if it was just me being stupid and using them wrong somehow. So I'm assuming they don't work and even though they're in the reference they're still slotted for the next release.
Uh, couldnt you just make a torquescript function that does incremental moves yourself?
Thx for those move functions anyways tho Matt. 'preciate it.
#4
08/03/2005 (7:22 pm)
The (get|set)Position(X|Y) commands work just fine here. In your original message you show the error, but not how you are calling it. For example, this works for me:$MySprite.setPositionX(10);
Torque Owner Jason Swearingen