After some testing, I noticed I made some mistakes. You want to divide angle by 360 divided by how ever many angles you have. In my example, I used 8 since I have 8 angles. Then you round it - you'll get a range from -4 to 4. Range changes depending on how many angles you have. 0 is up, 1 is top right, etc. Note that when it reaches -4, it goes to 4 but it's still pointing in the same direction. It's just that the angle becomes negative when the joystick ball is pointing to the left. Here are screenshots that should help.
[image: 5f99cd08-8eac-43aa-ba9d-62db7c6ae577.png]
[image: e5dcc55a-4925-43b9-a9e8-60917080fded.png]
[image: 81c1cdbb-0379-4152-b650-21162fc8ace4.png]
[image: 3819706f-95c4-446d-b962-5c61ec6c7f1a.png]