Hi @jazzarssoul,
The anchor point should be in content (world) coordinates. That means, you need to determine the anchor point relative to the enemy’s current location and rotation. Fortunately, you can use the “localToContent” API for this.
http://docs.coronalabs.com/api/type/DisplayObject/localToContent.html
So, let’s say you want the gun to be in the “right arm” of the enemy, at like x=50, y=0 relative to the enemy’s center point (so, the gun is offset to the right 50 pixels from its center). You’d just code this:
[lua]
local tx,ty = enemy:localToContent( 50,0 )
[/lua]
This will give you the exact world content points, no matter where the enemy is located or how it’s rotated (any of the 360 degrees). Use those values to attach the gun to the enemy using a weld joint. You’ll probably need to do this after you rotate the gun to the same angle as the enemy, so the gun is oriented properly.
Brent