Commit 6be25e12 authored by Nicolas LIENART's avatar Nicolas LIENART

Tower angle

parent f7e4464b
......@@ -368,7 +368,7 @@ void tour_updateShootingAngle(Tour* tour)
if (tour->targetMonster) {
double hypo = sqrt(pow(tour->x - tour->targetMonster->x, 2) + pow(tour->y - tour->targetMonster->y, 2));
double distance = tour->x - tour->targetMonster->x;
double angle = asin(distance/hypo)* 180.0 / M_PI + 180;
double angle = atan2(tour->y - tour->targetMonster->y, tour->x - tour->targetMonster->x)* 180.0 / M_PI - 90;
tour->angle = angle;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment