# Issue with addChild's X and Y value

**URL:** <https://forum.kirupa.com/t/issue-with-addchilds-x-and-y-value/331428>\
**Category:** Uncategorized\
**Created:** [July 30, 2013, 2:11pm UTC](https://forum.kirupa.com/t/issue-with-addchilds-x-and-y-value/331428 "2013-07-30T14:11:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![BindleStick](https://avatars.discourse-cdn.com/v4/letter/b/8491ac/32.png) [@BindleStick](https://forum.kirupa.com/u/BindleStick)\
**Post date:** [July 30, 2013, 2:11pm UTC](https://forum.kirupa.com/t/issue-with-addchilds-x-and-y-value/331428/1 "2013-07-30T14:11:24Z")

</div>

I have an Enemy class that deals with my monster moving and attacking. Within that class, I have another class called enemyMagic, which is a blank movieclip that serves as a masterclass to different movieclips that I will make.

So in the enemyMagic class, I add a movieclip called attack1

```auto
public var attack1:Attack1 = new Attack1;    
           public function EnemyMagic() {
                    ////////////CREATE THE TIMER//////////
                    masterEnemyAttackTimer.addEventListener(TimerEvent.TIMER, mastertimer);
                    
                    ////////////ATTACKS/////////
                    //TIER 1//
                    addChild(attack1);
        
                }

```

And in the enemy class, I add the enemyMagic when the enemy is attacking a certain position.

```auto
for (var k:int = 0; k < Main.tileset.length; k++)
                {

                    if (! Main.tileset[k].tileMiddle.hitTestObject(this.enemyVisionPoint))
                    {
                        if (Main.tileset[k].tileHP !== 0)
                        {
                            attackoptions.push(Main.tileset[k]);
                        }
                        if (Main.tileset[k].tileMiddle.hitTestObject(Main.player.visionPoint))
                        {
                            addChild(enemymagic);
                            Main.tileset[k].outline.gotoAndStop("attack");
                            this.enemymagic.x = (Main.tileset[k].x);
                            this.enemymagic.y = (Main.tileset[k].y);
                            trace(enemymagic.x, enemymagic.y, Main.tileset[k].x, Main.tileset[k].y); 

```

For some reason, the enemymagic is tracing the exact same number as the tile’s x and y, but it isn’t adding it on the tile. It adds it way off the screen. I think it might be because it starts on the enemy’s x and y and then calculates?

So my question is how can I get the enemymagic movie clip to get exactly on the position of the tile?
