# Actionscript 2 Shooting game problem

**URL:** https://forum.kirupa.com/t/actionscript-2-shooting-game-problem/315403
**Category:** Uncategorized
**Created:** [October 25, 2010, 12:49pm UTC](https://forum.kirupa.com/t/actionscript-2-shooting-game-problem/315403 "2010-10-25T12:49:37Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Garb](https://avatars.discourse-cdn.com/v4/letter/g/f6c823/32.png) [@Garb](https://forum.kirupa.com/u/Garb)
#### Post date: [October 25, 2010, 12:49pm UTC](https://forum.kirupa.com/t/actionscript-2-shooting-game-problem/315403/1 "2010-10-25T12:49:37Z")

</div>

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.

```auto

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:

> **[Arms At feet problem.](https://www.newgrounds.com/dump/item/19c4a2ed2c3187d90a0d98cb965b5e5f)**
>
> Arms At feet problem. by flashanimator21

And if anyone wishes to download the .fla, its here:

> **[Help with game](https://www.newgrounds.com/dump/item/4b9d3d440acac008181978d7bf1f25c8)**
>
> Help with game by flashanimator21

I will be more then happy to answer any questions.
