Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

Bombing run - 30 degrees angle difference


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)
        # Say the angle!

If I should not post working code, just let me know and I will delete it.


I think it’s because you are measure the angle from (0, 0) point instead from the hero.


How do you measure the angle from the hero?


You can use Vectors for this if you have Programmaticon V. Or instead enemy.pos.x use enemy.pos.x - hero.pos.x


Thanks: it works now!