How to Drag-n-Drop Circle object to a Circle Target
Ok, I'm working on a new math game and I need some help with the drag and drop system I am trying to build.
I have multiple draggable circle-shaped actors on the scene. Each of these drag-circles has a corresponding circular target area. The target-circles are organized on the scene to form a pyramid shape (eventually will have different shapes on other levels). I would like to program the game in a way that when the drag-circle moves close to the target-circle it snaps into place, otherwise on release it snaps back to it's original position.
I've looked at several videos on drag-n-drop, but I don't think they cover snapping to target or back to original position. And I don't believe they cover dragging and snapping to a circular target.
Thanks folks!
I have multiple draggable circle-shaped actors on the scene. Each of these drag-circles has a corresponding circular target area. The target-circles are organized on the scene to form a pyramid shape (eventually will have different shapes on other levels). I would like to program the game in a way that when the drag-circle moves close to the target-circle it snaps into place, otherwise on release it snaps back to it's original position.
I've looked at several videos on drag-n-drop, but I don't think they cover snapping to target or back to original position. And I don't believe they cover dragging and snapping to a circular target.
Thanks folks!
Best Answer
-
MarkOnTheIron Posts: 1,447
Ok, now I understand your problem.
It has nothing to do with the shape of the objects and targets. The problem here is with the shape of you imaginary grid that is triangular. Unfortunately my system is not applicable to your case. The only way I could see it done is by using tables were you put the coordinates of every target and then using trigger actors in your pyramid you can use the data in the table to snap the object in the target.
Answers
http://dl.dropbox.com/u/8244920/Snap_to_grid_demo.zip
I'm still having trouble working with locking a circle object into a circle target.
best!
http://dl.dropbox.com/u/15397573/pyramid.zip
If I could get the drag-circles to snap into the target-circles on the pyramid and snap back to their original positions...I think I can figure out the snapping back to original positions part of the program. Using the grid method in your demo, looks like I need to define a rectangular region as target area, but what if my region is a triangular pyramid or diamond shaped. I wouldn't want the snap to grid effect to be active if the user is outside of the grid area of the shape.
best.