Rotating around object problems

P

Guest
I'm creating a top down shooter game in which the view rotates with the player, instead of just the player rotating, and I was needing the ammo to display behind the player and rotate round the player. Luckily this Reddit post helped me out: https://www.reddit.com/r/gamemaker/comments/48qtdy/gms_rotating_an_object_around_the_origin_of/

However, the post only managed to get the mechanic working, but the position of the objects that display the ammo are completely wrong. The numbers are supposed to be directly behind the player, but end up towards the side:

This is the code I use to position each number (that represents each digit) before the code from the Reddit post starts (Digit is the variable I use to separate each number, as they are created by another object and set what digit they will be, with 5 steps interval in-between to prevent them from all being on one position):
if Digit = 100 {
x = Obj_Player.x - 10
y = Obj_Player.y + 32
} else if Digit = 10 {
x = Obj_Player.x
y = Obj_Player.y + 32
} else if Digit = 1 {
x = Obj_Player.x + 10
y = Obj_Player.y + 32
}

Does anyone know what is going on and how to fix this?
Note: The numbers are pointing towards the player as I set them to point in that direction, and not because of any of the code.

Attachments

• 295.9 KB Views: 3