I was able to solve bombing run, but I needed to add an extra 30 degrees to my atan2.
I compared with other codes posted in the forums because I cannot find the reason behind this additional 30 degrees, their codes where quite similar to mine but without the 30 degrees. Any suggestion?
while True: enemy = hero.findNearest(hero.findEnemies()) if enemy: # Find the vector of attack # Use trigonometry to find the the angle in Radians! # The answer must be in Degrees! # To convert Radians to Degrees multiply by (180 / Math.PI) angle=30+(Math.atan2(enemy.pos.y,enemy.pos.x))*(180/Math.PI) # Say the angle! hero.say(angle) hero.wait(4)
If I should not post working code, just let me know and I will delete it.