Been thinking about how to approach this problem recently - and I have a couple of ideas but I'm hoping for something a little more elegant.
I have a main "body" object and a smaller object which are part of the same container. I want to be able to freely move the small object around, but keep it constrained to the large "body" object within a defined circular radius. I have thought about using another sprite set to opacity 0 (and set as solid) as sort of a "wall" around the large object so the smaller object can't pass through - but that seems sloppy - and will cause issues with other objects colliding with the "wall".
The second idea I had was to use physics and just hinge the objects together with an armature (think of like, a rope tied between to objects). I didn't really want to go this way either, because adding physics to the project is only replacing one problem I'm having with another. I'm trying to do this to optimise some stuff - so going with a (probably) more CPU intensive method isn't really going to help.
Anyone got a better idea how to constrain the movement, maybe based on a distance calculation or something? The smaller object would need to have freedom of movement within the radius of the larger "body" but not be able to "escape" past a maximum distance in any given direction.
I'm sure this has been asked before, but for the life of me I can't find any real references to the problem.
Thanks in advance for any suggestions.
~Sol