Oh well!
No matter then.
I'll go back to my circle collision script. It has much improved since you implemented local variables. The only downside is that it only works with circular objects.
All the best.
/* actor collides with another actor (collide) */
collisionDistance = radius + collide.radius;
actualDistance = distance (x, y, collide.x, collide.y);
collNormalAngle = atan2(collide.y - y, collide.x - x);
/* position exactly touching - no intersection */
moveDist1 = (collisionDistance - actualDistance) * (collide.mass/(mass + collide.mass));
moveDist2 = (collisionDistance - actualDistance) * (mass/(mass + collide.mass));
x = x + moveDist1 * cos(collNormalAngle + 180);
y = y + moveDist1 * sin(collNormalAngle + 180);
/* collision response */
nX = cos(collNormalAngle);
nY = sin(collNormalAngle);
a1 = xvelocity * nX + yvelocity * nY;
a2 = collide.xvelocity * nX + collide.yvelocity * nY;
optimisedP = ( 2 * (a1 - a2)) / ( mass + collide.mass);
/* now find out the resultant vectors */
xvelocity = xvelocity - (optimisedP * collide.mass * nX);
yvelocity = yvelocity - (optimisedP * collide.mass * nY);
collide.xvelocity = collide.xvelocity + (optimisedP * mass * nX);
collide.yvelocity = collide.yvelocity + (optimisedP + mass * nY);