Hittesting

I have a mc (the_hero) which when collides with another mc (enemy_n), reverses its direction.

if (enemy_n.hitTestObject(the_hero)) {
	if (enemy_n.hitava==true) {
		enemy_n.angle4=Math.floor(Math.atan2(the_hero.y-enemy_n.y,the_hero.x-enemy_n.x)*(180/Math.PI));
		xspeed*=((-1)*Math.abs(Math.cos(enemy_n.angle4*(Math.PI/180))));
		yspeed*=((-1)*Math.abs(Math.sin(enemy_n.angle4*(Math.PI/180))));
	}
	enemy_n.hitava=false;
} else {
	enemy_n.hitava=true;
}

The problem is, that on continuous multiple collisions, the hero penetrates the enemy. Any way to not let that happen?