Jump to content

Code improvement suggestion for angleBetween() method


Recommended Posts

Hi everyone!

I don't really know where I should post this, thus I post it here. Maybe it's inappropriate, so please tell me where its rightful place may be.

I've come across some kind of a bug (maybe intended) and I'd like to suggest a fix. In the arcade engine, the angleBetween() method uses the x / y coordinates of the targeted sprites, and I think it should use the world.x / world.y coordinates instead. In my use-case, I had a character with a child sprite, its gun, that I wanted to point to the player. Because the gun was a child sprite, the angle was not correct and the gun wouldn't target the player.

What do you guys think? Are there use cases where it should be x / y instead of world.x / world.y? Maybe I should have used another method like angleToXY(), but I still kind of feel like angleBetween() should be fixed.

Also, I apologize in advance if this has already been debated over. If so, a link to the previous post would be great! :)

Have a nice day guys!


Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...