Hi, I’m making a flash game in AS2, and i am having troubles with my gun, i have fiddled with it for a while now and i have narrowed down the problem, but i can’t fix it. My problem is that i want a gun to follow the player, but the coordinates are messing up and going to his feet.
onClipEvent (enterFrame) {
_y += (_root.player._y-_y)/1; //This code makes it goto his feet, but the gun no longer follows player when he jumps.
_x += (_root.player._x-_x)/1;
_y = _root.player._y-offset;
this._rotation = 57.29*(Math.atan2((_parent._ymouse-this._y), (_parent._xmouse-this._x)));
}
onClipEvent (load) {
var scale:Number = _xscale;
var ex:Number = .2;
}
onClipEvent (enterFrame) {
if (Key.isDown(68)) {
}
}
onClipEvent (enterFrame) {
if (Key.isDown(65)) {
}
}
onClipEvent (enterFrame) {
if (Key.isDown(82)) {
_root.gun.compass.gun.gotoAndPlay("reloading");
}
}
This is messing up.
If anyone wants to play the game, the swf is here:
And if anyone wishes to download the .fla, its here:
I will be more then happy to answer any questions.