Quote:
Originally Posted by .mb
Agh. I feel stupid. It was working the whole time. The problem is that it was affecting the center of the object, which is used for spawning, not movement. So, how could I affect the already made object with my move to touch code?
|
You want to touch an object an move it? Like dragging?
You can either set up the objects themselves to respond to touches, like I said above, or handle it all here in the SiegeViewController.
To handle it here in the SiegeViewController, you'll have to set up so:
(1)You have a pointer to store the currently selected object.
(2)on touchesBegan, you look through your array of objects and find the nearest one to the touch point (pythaorean theorem.) Make that the currently selected object.
(3)On touchesMoved, move the currently selected object to the touch point.