I don’t understand some of the concepts. Here is my code:
while True:
enemy = hero.findNearestEnemy()
if enemy:
# Find the vector of attack
vector = Vector.add(enemy.pos, hero.pos)
# Use trigonometry to find the the angle in Radians!
radians = Math.atan2(hero.pos, vector)
degrees = radians * (180 / Math.PI)
hero.say(degrees)
There are no errors, the hero doesn’t even say a number. I think this part of the code:
# Find the vector of attack
vector = Vector.add(enemy.pos, hero.pos)
# Use trigonometry to find the the angle in Radians!
radians = Math.atan2(hero.pos, vector)
is incorrect. Can someone please help? And maybe even explain what the answer means?