# Collision With Other Instances Of Same Class

**URL:** <https://forum.kirupa.com/t/collision-with-other-instances-of-same-class/318762>\
**Category:** flash\
**Created:** [January 29, 2011, 7:02pm UTC](https://forum.kirupa.com/t/collision-with-other-instances-of-same-class/318762 "2011-01-29T19:02:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![DanDaMan](https://avatars.discourse-cdn.com/v4/letter/d/b19c9b/32.png) [@DanDaMan](https://forum.kirupa.com/u/DanDaMan)\
**Post date:** [January 29, 2011, 7:02pm UTC](https://forum.kirupa.com/t/collision-with-other-instances-of-same-class/318762/1 "2011-01-29T19:02:39Z")

</div>

Hey so I’m trying to make it so that the instances of the class “Enemy” stop completely when they get too close to each other. They are circles so determining a collision is easy. But when I used this code:

```auto

if (Math.sqrt(Math.pow(x-_root.newEnemy.x, 2)+Math.pow(y-_root.newEnemy.y, 2))<=width+3) {
	canMove=false;
}

```

I get this error message:

```auto

TypeError: Error #1010: A term is undefined and has no properties.
	at Enemy/eFrame()

```

This code works just fine when I test it against the instance of a different class, but it’s not working for some reason. How do I fix this? Thanks (:
