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:
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:
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 (: