# Advanced Collision - Help Needed

**URL:** <https://forum.kirupa.com/t/advanced-collision-help-needed/226077>\
**Category:** flash\
**Created:** [May 17, 2007, 11:39pm UTC](https://forum.kirupa.com/t/advanced-collision-help-needed/226077 "2007-05-17T23:39:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jellyhead365](https://avatars.discourse-cdn.com/v4/letter/j/c4cdca/32.png) [@Jellyhead365](https://forum.kirupa.com/u/Jellyhead365)\
**Post date:** [May 17, 2007, 11:39pm UTC](https://forum.kirupa.com/t/advanced-collision-help-needed/226077/1 "2007-05-17T23:39:11Z")

</div>

Hi,

I’ve followed the Advanced Collision tutorial on this site but am having a few problems.

I’ve created the required MovieClips within one another:

Spaceship\_mc; contains Perim; which contains lots of PerimBlock\_mc 's (positioned around the perimeter of the Spaceship\_mc shape)

The code I’m using is:

```auto
for (i in this.perim) {
     this.perim.localToGlobal(p={x:this.perim*._x,y:this.perim*._y});
     if(_root.bg_mc.cave_mc.hitTest(p.x, p.y, true)) {
          this._alpha=50
     }else{
          this._alpha=100
     }
}

```

The problem is that the collision is only detected for 1 of the Blocks around the Spaceship’s perimeter.

Could someone help with the code, I assume the loop isn’t working correctly (also not sure what the ‘i’ is really, should this be declared as a variable, or increased after each loop?)

Thanks in advance.
