# Refering to multiple instances?

**URL:** <https://forum.kirupa.com/t/refering-to-multiple-instances/228307>\
**Category:** programming\
**Created:** [June 6, 2007, 7:58pm UTC](https://forum.kirupa.com/t/refering-to-multiple-instances/228307 "2007-06-06T19:58:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Copes](https://avatars.discourse-cdn.com/v4/letter/c/f07891/32.png) [@Copes](https://forum.kirupa.com/u/Copes)\
**Post date:** [June 6, 2007, 7:58pm UTC](https://forum.kirupa.com/t/refering-to-multiple-instances/228307/1 "2007-06-06T19:58:15Z")

</div>

Hi everyone.

im having trouble finding a way to write a little bit of code that will control all of my npc’s stopping when they bump into each other (the actual stoping and letting each other past im not worrying about yet.) its just the getting them to stop when they bump into each other, without me having to write the same bit of code to refer to each npc i have on the level.

this code is inside each npc’s mc:

```auto

onClipEvent (enterFrame) {
if (this.hitTest(_parent._parent._parent.[COLOR="SeaGreen"]"another npc"[/COLOR])) {
_parent._parent.collisionEngine.gotoAndPlay(2);
	}
}

```

obviously that doesnt work, but i was wondering if anyone knew a way refer to all npc’s mc’s within a certain mc.
