• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Rotating around object problems

P

Pokemadman

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:
upload_2017-10-12_19-48-0.png

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

Top