Hi!
Yes, I see the logical with the sprite used in that example (AUM 84 - 2dcollision4), and it works fine then.
I just removed the + 20 from (coords2_y = my_player.pos_y;) in player head since I don’t want some part of players head to be inside the red color in this case.
At the corner it blocks only the half of the player since it’s divided by 2.
That’s logical since when more than half of the player is outside the red colors edge, it will not block.
That’s fine with the code from AUM, but thinks about it like a Pong game. If the player head is the ball,
it would not block correctly when it reaches the pad. If half of the player is outside the corner of the pad, it will pass through.
Without /2, it will block all the width of the player when it reaches the pad, but just on one corner.
PS! I’m not going to make a pong game with this code solution.
Pong examples:
Here it blocks fine when divided by 2
Here it don’t block since more than half of the player are on the outside of the red color.
If I remove / 2 it block all the players width fine
but not at the opposite corner when some part of the player are ouside the red color
I will anyway try to find a solution for this without the if statements I used in my last example
.