Game Development Community

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".

#1
10/02/2005 (10:04 pm)
Sure - plus as string concatenator only works in Basic. Try using the SPC operator instea as you did in the one case.
#2
10/03/2005 (5:05 am)
I'm not using '+' as a string concatenator, I'm using it for numerical addition.