# Duplicate MC-HitTest

**URL:** <https://forum.kirupa.com/t/duplicate-mc-hittest/9907>\
**Category:** flash\
**Created:** [December 20, 2002, 5:26pm UTC](https://forum.kirupa.com/t/duplicate-mc-hittest/9907 "2002-12-20T17:26:57Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![BullDog\_Flash](https://avatars.discourse-cdn.com/v4/letter/b/d07c76/32.png) [@BullDog\_Flash](https://forum.kirupa.com/u/BullDog_Flash)\
**Post date:** [December 20, 2002, 5:26pm UTC](https://forum.kirupa.com/t/duplicate-mc-hittest/9907/1 "2002-12-20T17:26:57Z")

</div>

See i wanna make a christmas special game  
Before christmas is here.  
So i have trouble having a duplicated MC to have a hitTest.  
Im goanna make a santa claus cathcing game…

Maybe examples tutorials or explainers that are out there and can help me out.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 20, 2002, 6:52pm UTC](https://forum.kirupa.com/t/duplicate-mc-hittest/9907/2 "2002-12-20T18:52:36Z")

</div>

When you duplicate a movieCLip… Do this:

```auto

duplicateMovieClip(_root.santa, "santa"+ii, ii);

```

ii just increments itself everytime you put a new duplicateMovie in it… I have some other ideas for you as well… But I’m starving… Hungie Hungie Homie…

_lol_

btw… When doing a hitTest then…

```auto

if(_root.ball.hitTest(_root["santa"+i]){}

```

Then just figure out some kind of loop to loop aorund the santa’s you already have on screen… And this… And you’re made… I know a way to… But am hungry… peace.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 20, 2002, 7:00pm UTC](https://forum.kirupa.com/t/duplicate-mc-hittest/9907/3 "2002-12-20T19:00:20Z")

</div>

Thnaks Marz  
Ill make ann example to see what i can do first.

My santa game will be a cathcer at the bottom of screen and santa’s falling.  
When that happend i want the santa that got caoght to dissaper

That wil gie you a better example to know what im talking about.

Im goanna make an example now to see what happends.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 20, 2002, 7:09pm UTC](https://forum.kirupa.com/t/duplicate-mc-hittest/9907/4 "2002-12-20T19:09:35Z")

</div>

When you get bcak can you help me with this.  
See i have an example i found on flashkit  
and well i this is a big code and not sure how it works maybe some opne can define it for mme…

The falling santa

```auto
onClipEvent (load) {
    if (_name == "ballParent") {
        _visible = 0;
        _root.array = new Array();
        _root.arraySize = 0;
        ticks = 0;
        i = 0;
    } else {
        _x = _width/2+random(550-_width/2);
        speed = 10+random(4);
        move = 1;
    }
}
onClipEvent (enterFrame) {
    if (_name == "ballParent") {
        ticks++;
        if (ticks>25) {
            this.duplicateMovieClip("ball"+i, i+10);
            _parent["ball"+i].name = i;
            _root.array[_root.arraysize] = i;
            _root.arraysize++;
            i++;
            ticks = 0;
        }
    } else {
        if (move == 1) {
            _y += speed;
            if (_y>410) {
                move = 0;
            }
        } else {
            for (i=0; i<_root.arraysize; i++) {
                if (_root.array* == name) {
                    // trace(_root.array);
                    for (j=i; j<_root.arraysize-1; j++) {
                        _root.array[j] = _root.array[j+1];
                    }
                    delete _root.array[_root.arraysize];
                    _root.arraysize--;
                    i = _root.arraysize;
                }
            }
            removeMovieClip("");
        }
    }
}
onClipEvent (load) {
    _root.array[_root.arraysize] = i;
    _root.arraysize++;
}

```

The collector

```auto
[onClipEvent (mouseMove) {
    _x = _root._xmouse;
}
onClipEvent (enterFrame) {
    for (i=0; i&lt;_root.arraysize; i++) {
        if (hitTest(_root["ball"+_root.array*])) {
            _root["ball"+_root.array*].move = 0;
            /:_root.score = _root.score + 1;
        }
    }
}
/CODE] 
If this can be optimized please tell me and tell me how the code works..

Please hlp me..
```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 20, 2002, 7:12pm UTC](https://forum.kirupa.com/t/duplicate-mc-hittest/9907/5 "2002-12-20T19:12:08Z")

</div>

Maybe it would be better if i attach the file…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 20, 2002, 9:03pm UTC](https://forum.kirupa.com/t/duplicate-mc-hittest/9907/6 "2002-12-20T21:03:58Z")

</div>

Any One come On i need to make this game…

Here is the file

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 20, 2002, 10:34pm UTC](https://forum.kirupa.com/t/duplicate-mc-hittest/9907/7 "2002-12-20T22:34:37Z")

</div>

I’ll take a look at it later tonight man!

Peace

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 20, 2002, 11:53pm UTC](https://forum.kirupa.com/t/duplicate-mc-hittest/9907/8 "2002-12-20T23:53:37Z")

</div>

Are you done looking at it…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 21, 2002, 4:27am UTC](https://forum.kirupa.com/t/duplicate-mc-hittest/9907/9 "2002-12-21T04:27:17Z")

</div>

Well is tonight here yet  
::Yees says the man in blue and cheers to the fans beside him::

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 21, 2002, 9:03am UTC](https://forum.kirupa.com/t/duplicate-mc-hittest/9907/10 "2002-12-21T09:03:36Z")

</div>

_lol_… Sorry man… Ended up going to a friend’s hosue til 3:30 am… _lol_… Just got back home…

Lemme see here… _looking at code right now_

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 21, 2002, 9:14am UTC](https://forum.kirupa.com/t/duplicate-mc-hittest/9907/11 "2002-12-21T09:14:15Z")

</div>

After looking at it… I could come up with soemthing that’ll flow ALOT smoother and should get the effects you wnat done alot easier… But for tonight… I’m passing out now… have fun…

Peace Out Man

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 21, 2002, 5:04pm UTC](https://forum.kirupa.com/t/duplicate-mc-hittest/9907/12 "2002-12-21T17:04:50Z")

</div>

So are you goanna make the code for me later
