Cocos2D Drag Drop Sprite Question
I am starting a simple game with Cocos2D. I have a few sprites 开发者_Python百科that I can drag and drop using UIPanGestureRecognizer.
The game will consist of draggin an image to a specific spot on the screen. Imagine a US State puzzle where you need to drag the image of Texas to the outline of Texas.
I have the dragging and dropping fine but what should I do to handle the dropping in the correct area? Is that considered collision? Will a TileMap work with something like this?
I am stuck trying to find out the best way to do this.
You could use a plist of points on the screen, and let the state be considered correct if it was within x distance of that point.
The problem with collision is that you'd need to set a margin of error: I could put texas in new mexico and have it still touching the correct spot.
I'd figure out exactly where each needs to go, then compare the point where the user dropped the state to the correct point using the distance formula.
精彩评论