how do i make a code that detect where the player is moving at 8 directions for melee attacks


was trying this out it not working so well