T
Taten
Guest
Okay, I'm relatively new to programming so bare with me here. I was following heartbeast's tutorial on making a simple rpg, and am currently on ep.24(i think..?) I decided I wanted a grid system of rooms Link's Awakening DX style so I got to work trying to figure it out. I figured I could use the player_stats object to track the player's x and y position, and then put them into variables(last_x and last_y).
Using those I could line each side of the room with the door object, and have it so when the player runs to the edge of the room, it would use the last_x and last_y variables to place the player in the next room accordingly. Obviously since I'm writing this that is not how that went.
I've boiled down the problem to this singular thing: the door isn't updating the last_x and last_y variables, and simply goes with what I first initialized in the create event(it used to be 0 and 0 but that made the whole thing crash so I switched it to 32 and 32)
In the player_stats step event, I have this simple if statement running:
I have a draw gui event proving the Variable is updating, so what gives? Why won't the door use the updated variable?
Thank you,
taten
attached is a video showing my problem in action
Using those I could line each side of the room with the door object, and have it so when the player runs to the edge of the room, it would use the last_x and last_y variables to place the player in the next room accordingly. Obviously since I'm writing this that is not how that went.
I've boiled down the problem to this singular thing: the door isn't updating the last_x and last_y variables, and simply goes with what I first initialized in the create event(it used to be 0 and 0 but that made the whole thing crash so I switched it to 32 and 32)
In the player_stats step event, I have this simple if statement running:
Code:
if (instance_exists(obj_player)) {
last_y = round(obj_player.y);
last_x = round(obj_player.x);
}
Thank you,
taten
attached is a video showing my problem in action