I'm getting back into C3 after a few months and I'm definitely rusty. I'm getting some inconsistency in my new code and I think I may be picking objects incorrectly...
Each enemy in my platformer used to just be a sprite, but to make things smoother I'm adding logic for an enemyBox 'anchor' sprite used for positioning and smooth movement. Each enemy sprite will now have a corresponding enemyBox object. The enemy and enemyBox sprite objects both have an instance variable called uniqueID, and it's this variable that ties them together.
What's the best way to pick the enemy and enemyBox objects that have the same uniqueID? For instance I want the following code to position the enemy where its enemyBox is, but in certain situations enemies are placed on the wrong enemyBox. I believe this code may sometimes be picking the wrong enemyBox or just picking one at random. Is this the right/best way to pick an enemy object AND enemyBox object that have the same uniqueID instance variable?