2.5D FPS game enemies facing multiple directions

What would be the easiest way to make enemies in a 2.5D FPS game facing multiple directions? I'm thinking like Doom or Wolfenstein, or any 2.5D game really, where the enemies have different sprites for like 8 directions and they keep changing depending on what angle the player character sees them from. So, how can i have them face me when they attack, face away from me when they run away etc.
Thanks beforehand!


ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
You would need to find angle_difference between the enemy's facing angle and camera facing angle, round that to nearest multiplier of 45 (for 8 directions, round(angle/45)*45)), and then assign sprites/subimages based on that