M
mario_head
Guest
I've been following the instructions of a video on YouTube for coding in doors that warp the player to other rooms, and after following his exact instructions I've run into an error. In the build process when loading the game, an error appears:
The actual code:
The video:
The top comment on the video has stated that the error was with the Player object not being persistent, however I've made it persistent and nothing has changed. I've tried defining the variables within the code and the error has not resolved. I've been dealing with this issue for about a week or so now (I took a break from it to prevent myself from getting too worked up over it).
I apologize if any part of this thread is lacking. I'm relatively new to Game Maker (I've made a game using DnD many years ago and it's half-broken due to imported resources that I no longer have access to) and this is my first forum post.
Code:
############################################################################################
FATAL ERROR in
action number 1
of Other Event: Room Start
for object obj_player:
Variable obj_player.player_x(100003, -2147483648) not set before reading it.
at gml_Object_obj_player_StartRoomEvent_1 (line 1) - x = player_x;
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_obj_player_StartRoomEvent_1 (line 1)"
Code:
obj_player:
obj_player_Create_1
sprite_index = spr_spess; (Unrelated)
image_speed = .75; (Unrelated)
obj_player.persistent = true; (Sets Persistent)
//var player_x = x; (Failed Attempt to Define the Variables in Question)
//var player_y = y; (Failed Attempt to Define the Variables in Question)
obj_player_obj_door_1 (Collision Event with Door)
player_x = other.target_x;
player_y = other.target_y;
obj_player_Room Start_1
x = player_x;
y = player_y;
obj_door_control
obj_door_control_Game Start_1
obj_player.player_x = obj_player.xstart;
obj_player.player_y = obj_player.ystart;
room_goto(other.targetRoom);
obj_door Creation Code in (Starting Room)
target_Room = (Next Room);
target_x = 1728;
target_y = 224;
The top comment on the video has stated that the error was with the Player object not being persistent, however I've made it persistent and nothing has changed. I've tried defining the variables within the code and the error has not resolved. I've been dealing with this issue for about a week or so now (I took a break from it to prevent myself from getting too worked up over it).
I apologize if any part of this thread is lacking. I'm relatively new to Game Maker (I've made a game using DnD many years ago and it's half-broken due to imported resources that I no longer have access to) and this is my first forum post.