Game Development Community

adding( x + x, y + y)

by rennie moffat · in Torque Game Builder · 04/20/2010 (4:10 pm) · 4 replies

Hi,
is there a way beyond t2dVectorAdd to add a couple of vectors in game? For instance, could I say...


%this.owner.setPosition(%this.owner.position + %this.xyoffset);

The reason I ask is because when I setPositions, with an object position + offset I need to set, or get x and y of the object then x and y of the offset. I would prefer if I could just somehow add the two vectors......



I guess, just t2dVectorAdd eh? set to a variable.






::::]


About the author

My thanks to Garage Games and the Garage Games Community combined with owned determination I got one game up, Temple Racer and I am looking to build more interesting, fun games for the mass market of the iOS app store.


#1
04/20/2010 (11:19 pm)
try :
%this.owner.setPosition( t2dVectorAdd( %this.owner.position, %this.xyoffset ) );
#2
04/21/2010 (6:40 am)
right will do. I was not thinking that I could plug the vector method into the string.




#3
04/21/2010 (12:45 pm)
In fact, all is treated as strings in TorqueScript.
#4
04/21/2010 (1:00 pm)
meaning?