Ok, so I have a guy, and his arm holding a gun rotates towards the mouse, much like Thing Thing. However, this guy has a shoulder, and the gun is rotating from the shoulder. Naturally, this gives some errors when spaning bullets, since the shoulder is the _y position, not the gun barrel. The nub is this. The _y value needed to add to the orignal value changes depending on the rotation. Therefore there must be a correlation between the two. If there is a correlation, there must, logically, be a formula. My question is this: Does anyone know the formula I would need to calculate the distance in any circumstance, and make the bullet line up to the barrel at any rotation?
If anyone has a clue how to do this, I would be eternally grateful.
onClipEvent(load){
spd=20;
if(_root.guy._xscale == 100){
_x=_root.guy._x+_root.guy.gun._x;
_y=_root.guy._y+_root.guy.gun._y+_root.guy.gun.point._y;
_rotation= _root.guy.gun._rotation-90;
}else{
_x=_root.guy._x+_root.guy.gun._x;
_y=_root.guy._y+_root.guy.gun._y+Math.sqrt(_rotation);
_rotation= -_root.guy.gun._rotation+90;
}
}
AS 2.0