# Duplicates Causing Else To Screw Up

**URL:** <https://forum.kirupa.com/t/duplicates-causing-else-to-screw-up/271754>\
**Category:** flash\
**Created:** [September 27, 2008, 9:58pm UTC](https://forum.kirupa.com/t/duplicates-causing-else-to-screw-up/271754 "2008-09-27T21:58:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![alleballe90](https://avatars.discourse-cdn.com/v4/letter/a/9fc348/32.png) [@alleballe90](https://forum.kirupa.com/u/alleballe90)\
**Post date:** [September 27, 2008, 9:58pm UTC](https://forum.kirupa.com/t/duplicates-causing-else-to-screw-up/271754/1 "2008-09-27T21:58:46Z")

</div>

I am trying to make a game in which you command a sniper to shoot zombies. u command them by moving ur mouse over the enemies. BUT THERE IS A FAT PROBLEM.

onClipEvent (enterFrame) {  
var numEnemy = 100  
for(var i=1; i\<=numEnemy ;i++){  
if (this.hitTest(\_root[“enemy”+i])) {

```
        this._x = _root["enemy"+i]._x - 5
        this._y = _root["enemy"+i]._y - 5
        this.play();
        _root.sniperReady = 1
        } else {
        _root.sniperReady = 0
        
        

        
    }
}

```

}

The last part with the } else { command is screwing stuff up. sniperReady is ALWAYS 0 instead of being 1 when enemy is pointed at and then 0 when u r not pointing at an enemy. I am pretty sure it has something to do with the fact that the zombies duplicate I.E. \_root[“enemy”+i] thingy.

PLEASE HELP HOMIESZZZZ
