Before proceeding, please use the forum search feature at the top of the page to check if your question has already been answered.

How do I…

I am creating this block breaker-style game, Everything seems to be going smoothly except the animation and movement

What is the expected result

I want it that the animation changes based on the angle of movement, for example if the player’s ball is moving up then the animation will change to up or if it’s moving left, it will flip horizontally. but i can’t seem to get the angles and positions right.

Just to give you tip
In condition i check if angle of movement is 180° but then i add 90° tolerance
That tolerance is not 45° one side + 45° other side
It is 90° one way and 90° other way
So if i check if something is moving toward 180° angle
I also check if it is moving 180°+90° and 180°-90°
So it checks range from 90° to 270°
Armed with that knowledge you just need to check ranges for whatever angles you want

If you need help and you have events that aren’t doing what you expect, it’s best to include screen shots of those events. That makes figuring it out a lot faster.

IF
For 2 ways it was 90
For 4 ways it was 45 so half of above
Then
For 8 ways how much it would be?
Well another half which would be something like 22 or 23 if you can put decimal there than exactly 22.5

So moving directly to the right is going into either 360° or 0°
You want to range it 90° up and down
So you get range from 270° and 90°
Where 360°-90° is 270° and 0° + 90° is well 90°
And for left it would be
180° and 90° tolerance
So range from again 90° to 270°
Since 180° - 90° is 90° and 180°+90° is 270°
So looking at this diagram if you split it to 4 directions
Up down left right
You have
UP 270°
Right 0° and/or 360°
Down 90°
Left 180°
So your range need to be smaller to account for 4 directions
So it would be 45°
How to check that?
Well look if right is 0° and down is 90°
Than you want to split it into half which would be 45°
So now for 8 ways
If right is 0°
Down right is 45°
Than all you need to do is split right and down right into half
So 45°/2 would be exactly 22.5°
Since IDK if you can use decimals AND if you can’t you go with either 22 or 23