# Math.atan2 shooting Game

**URL:** <https://forum.kirupa.com/t/math-atan2-shooting-game/265791>\
**Category:** programming\
**Created:** [July 12, 2008, 3:31pm UTC](https://forum.kirupa.com/t/math-atan2-shooting-game/265791 "2008-07-12T15:31:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amymation](https://avatars.discourse-cdn.com/v4/letter/a/bc8723/32.png) [@Amymation](https://forum.kirupa.com/u/Amymation)\
**Post date:** [July 12, 2008, 3:31pm UTC](https://forum.kirupa.com/t/math-atan2-shooting-game/265791/1 "2008-07-12T15:31:53Z")

</div>

Hi everyone,  
I’ve been wanting to make a type of game where the character can move left to right while the user shoots with the cursor, but I want the arms to be attached to the curcor … well not attached but is dragged by it.  
At the moment I can’t find an example so I hope you all understand me.

If you could find a tutorial for this type of game please share it with me!  
(Please dont give me tower defense & balloon shoot tutorials Ive seen them and there not like the game I want)

---

<div class="post-metadata">

**Author:** ![bluemagica](https://avatars.discourse-cdn.com/v4/letter/b/a4c791/32.png) [@bluemagica](https://forum.kirupa.com/u/bluemagica)\
**Post date:** [July 12, 2008, 3:50pm UTC](https://forum.kirupa.com/t/math-atan2-shooting-game/265791/2 "2008-07-12T15:50:35Z")

</div>

err…i dont get it exactly… but if you just want a guy who can aim at the mouse with rotating arms, and shoot at it! Then just put the arm inside the chars mc…if not, explain yourself some more!!

---

<div class="post-metadata">

**Author:** ![Amymation](https://avatars.discourse-cdn.com/v4/letter/a/bc8723/32.png) [@Amymation](https://forum.kirupa.com/u/Amymation)\
**Post date:** [July 15, 2008, 11:56am UTC](https://forum.kirupa.com/t/math-atan2-shooting-game/265791/3 "2008-07-15T11:56:06Z")

</div>

[QUOTE=SparK\_BR;2358431]ok, the char moves with the A and D keys and you shot with the mouse…

the mouse is a crosshair and the weapons(arms) are always aiming to the mouse  
I played a game like this once, it’s was called “abuse”.

i think it’s simple to do, it’s the same as a normal shooter game(metal slug like) but with 2 simbols(classes) inside 1

the player has 2 classes in it  
the player has the registry point in the bottom  
the player.arms too  
and the player.body has the registry point where the arms should be fixed(torso);

the arms part position is the same X and Y of the body

```auto

onClipEvent(enterFrame){
    this._x = _parent.body._x;
    this._y = _parent.body._y;
}

```

the arms part has 2 simbols, one inside of the other  
the arms itself and the gfx;

then you could just make gfx.\_yscale \*=-1 to make it not get upside down;  
:proud:

* * *

it’s harder than i tought :stare:[/QUOTE]

That’s exactly what I wana do but I’m sort of a newbie so could you explain in a bit more detail or if it’s easier for you add me on AIM or MSN:  
[theghettoprincess@hotmail.co.uk](mailto:theghettoprincess@hotmail.co.uk)

AIm: Amymationgirl
