Moving Gui controls diagonally
by Eric · in Torque Game Engine · 09/26/2005 (5:43 am) · 2 replies
I'm trying to move this GUI control diagonally, using a "direction" variable, that is initialized to: "1 1".
For some reason, the control only moves on the Y axis, but never on the X axis. I just can't figure out why.
function MoveBall(%this)
{
%vecX = GetWord(%this.direction, 0);
%vecY = GetWord(%this.direction, 1);
%this.position = GetWord(%this.position, 0) + %vecX * $ballSpeed SPC
GetWord(%this.position, 1) + %vecY * $ballSpeed;
}
Is there something I'm not seeing here? I tried echo-ing the values, and "direction is always "1 1".
For some reason, the control only moves on the Y axis, but never on the X axis. I just can't figure out why.
function MoveBall(%this)
{
%vecX = GetWord(%this.direction, 0);
%vecY = GetWord(%this.direction, 1);
%this.position = GetWord(%this.position, 0) + %vecX * $ballSpeed SPC
GetWord(%this.position, 1) + %vecY * $ballSpeed;
}
Is there something I'm not seeing here? I tried echo-ing the values, and "direction is always "1 1".
About the author
#2
10/03/2005 (5:05 am)
I'm not using '+' as a string concatenator, I'm using it for numerical addition.
Associate Kyle Carter