Inverted
by rennie moffat · in iTorque 2D · 03/31/2011 (10:12 am) · 5 replies
Hi there,
I have built the script required to drag an object that is large in size, ie bigger then 1/2 the screen. The reason why this is special is because with out careful consideration of any offset that may exist between the objects original point and the original touch point, the object will jump to the original touch point. Not cool. So what I have done is account for the offset. No problem right? right.
However there is one issue I can not seem to solve. The inversion. In my code anyway, the result is, if I want to drag the object left, I must swipe/drag right, same for up and down. Anyone have any ideas of how I can solve this? Simply switching a negative to a positive has not been the answer as you must consider the objects original point and the result I got with that was more jumping.
I have built the script required to drag an object that is large in size, ie bigger then 1/2 the screen. The reason why this is special is because with out careful consideration of any offset that may exist between the objects original point and the original touch point, the object will jump to the original touch point. Not cool. So what I have done is account for the offset. No problem right? right.
However there is one issue I can not seem to solve. The inversion. In my code anyway, the result is, if I want to drag the object left, I must swipe/drag right, same for up and down. Anyone have any ideas of how I can solve this? Simply switching a negative to a positive has not been the answer as you must consider the objects original point and the result I got with that was more jumping.
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.
#2
Anyhow I will try in a bit.
Thanks.
03/31/2011 (10:34 am)
Ok thanks. I will try it out when I get a minute. A quick scan tho did not look promising. Did this work for you tho. My thing is I get an offset (ogObjectPos - ogTouchPos), then get a whereToSetTheObjectPos (runningTouchPos + offset).Anyhow I will try in a bit.
Thanks.
#3
03/31/2011 (11:09 am)
so do runningtouchpos - offset :P
#4
03/31/2011 (11:14 am)
You realize you cant add "1 1" and "2 2", right? You have to break it into x and y using getWord
#5
Cheers!
:))
03/31/2011 (11:49 am)
Thanks and yes I do realize you cant add them, just saving typing space. Cheers!
:))
Torque Owner Chris Labombard
Premium Preferred
%currentspotX - %touchspotX.
Same with Y
Also keep in mind that the coordinate is top left based. top left corner is 0,0
As you move Up the screen the Y coordinate decreases.