Hi,
I have a 2d overhead game in a style similar to zelda. I’d like to have an indicator that shows up when you’re near an NPC who can sell you health and weapons and stuff. It will be just a simple arrow graphic, like a triangle. Regardless of where the indicator is on screen, it should point in the direction to the NPC from the player’s current location.
I can’t figure out how to rotate the indicator object based on the player’s position. Does anyone have a code snippet you can share that can return a heading in degrees for one object from another object’s position? I’ve searched and found a number of solutions for 3D, but the game is 2D on the XY plane, so I rotate on the Z axis. I can’t wrap my head around how to translate the 3D solutions to 2D.
Thanks in advance for help!