GameMaker gms2 variables (SOLVED)

KPJ

Member
Hi everyone. I am making a top down shooter and I need help. I want the player's x and y position to be stored in a variable at a certain time in the game. How can I make it so that the variable never changes( when i set the variable to the player's x and y) it constantly is changing every frame. How do I work around this? Any help? Thanks!
 
M

mont266

Guest
Are you setting the coordinates in a step event? Because that would explain it. You could set the variables in a timer and then just trigger the timer whenever you want to store them again.
 
  • Like
Reactions: KPJ
M

mont266

Guest
I'm not entirely sure about how you're using it all, but it's as simple as setting up an Alarm event. Putting your code for getting the player's coordinates inside the Alarm event.

Then you can set the alarm off with:
Alarm[0] = room_speed * 1;

The '1' is the number of seconds before the alarm is triggered.

How are you wanting it to be triggered? You could use an if-statement inside a step event to store it aswell

Could you share your step event?
 
  • Like
Reactions: KPJ
Top