I'm currently working on a game that features a bunch of blocks that you can mine through (Just think of Minecraft but it's not Minecraft haha). The game is in 2D and I'm wanting a specific block to be mined depending on the keys pressed on the keyboard. So if I press to the left then the left block will be mined. If I press to the left and up at the same time then the block at the top left of the player will be mined.
I'm struggling on figuring out a way to determine which direction a block is from the player. I'm currently looping through all blocks that are near the player but just need a way to determine their direction (preferably as North, South, West, East, etc). Anyone got any ideas of how I could achieve this? (I originally had the idea of using raycasts that point out in all mineable directions to determine the direction but I wasn't sure if that was the best way to do it?)