Question

I know it seems like it's a fairly easy to do, but i can't seem to figure it out and i've researched a lot of places but really what i want it's no where. i'm creating a puzzle game and the images are moved around using UIGestureRecognizers but let's say if the puzzle piece does not fit into the right location, i want it to move to it's original position or previous position where i got it from. Can someone please shed some light on this on ho to do this? Thanks

Was it helpful?

Solution

The easiest thing to do would be to add a property to your view controller to store the CGPoint of the puzzle piece before you move it. Check for UIGestureRecognizerStateBegan in the state of the recogniser(which i think you must already be doing in order to start moving the puzzle piece) and update the property with the touch location from the view.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top