Ok, im makeing a side scroller shooter game where you point and click to shoot with your mouse. I wanted to make it so instead of actualy shooting a bullet movie clip out of your gun on mouseDown, just have a line apear for a split second between your gun and the enemy.
To do this i used the pythagoron therom (a^2 + b^2 = c^2)
in the code its:
x = _root.hero._x - _xmouse
y = _root.hero._y - _ymouse
_root.hyp = Math.sqrt(xx + yy)
Then i made a movie clip of a line and set its _xscale to c, and then set the lines _rotation to the same as the guns
my only problem is when the line rotates around it becomes thicker and thiner, also at a point the line stops growing and there is a gap between the gun and the enemy. how can i fix this? id i do the pythagorian equation wrong or something?