The behavior you asking for is actually very complex in practice. The best way I've found to do it is to use pathfinding for finding the path, then use physics for moving along the path by setting the velocity.
This creates some problems, though - like objects pushing other objects out of the way, so some objects can miss their nodes, and try to move backwards along the path to get back to them, and sometimes that involves moving through a wall and they get completely stuck, so then you need to keep the objects constantly checking for a path to their destination, but if you do it all at once on all instances every tick it can be too much CPU use and slam the framerate hard, so you have to cycle through the instances instead, only doing one per tick or such. Also there's the issue of what happens if the object can't get to a location because its already occupied by too many objects. To solve this I have the objects check how far they've moved in the past second, and if it's beneath a threshold, try to find a path again, and if that doesn't work, stop trying to move along the path.
Maybe there's a better way of doing it, but that's how I managed it.
However, if you only want them to not overlap when not moving rather than when moving, it's a ton easier. You could place a destination sprite at the mouse click and push it out of any objects, or you could give objects physics behavior, and disable collisions with other objects when it's moving along a path. Then when it stops moving, turn them back on again.Arima2013-04-28 20:26:46