# Duped Movieclips Trouble

**URL:** <https://forum.kirupa.com/t/duped-movieclips-trouble/303411>\
**Category:** flash\
**Created:** [January 20, 2010, 1:02am UTC](https://forum.kirupa.com/t/duped-movieclips-trouble/303411 "2010-01-20T01:02:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Danny0123](https://avatars.discourse-cdn.com/v4/letter/d/90db22/32.png) [@Danny0123](https://forum.kirupa.com/u/Danny0123)\
**Post date:** [January 20, 2010, 1:02am UTC](https://forum.kirupa.com/t/duped-movieclips-trouble/303411/1 "2010-01-20T01:02:54Z")

</div>

I’m working on a game where you have to avoid walls and such.

Anyways, I made it so **every ten seconds, the wall speed gets faster**. This method works, but it has some bugs.

First, **the duped MCs will not hitTest with the player**. I know this is most likely caused because the duped MCs are on a negative depth. But I cannot fix it.

Also, **whenever the generate() function runs, all the other walls disappear**.

The code is below, if anyone can tell me what the problem is, I’d be real happy.

```auto
var speeed:Number = 10;

gen = setInterval(generate, 1000);
levelUpper = setInterval(levelUp, 10000);

function levelUp() {
    if (speeed<25) {
        speeed += 1;
        level++;
    }else{
        speeed += 0;
        level += 0;
    }
}

i = 1;

function generate() {
    i++;
    var blueWall:MovieClip = attachMovie("wall", "wall"+i, this.getNextHighestDepth());
    blueWall._x = Stage.width;
    blueWall._y = random(Stage.height);
blueWall.onEnterFrame = function () {
with(this){
    if (_x<0) {
        removeMovieClip();
    }
    blueWall._x -= speeed;
}
}
};
//hitTesting
if (ship.hitTest(blueWall)) {
    gotoAndStop(2);
}

```
