• 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!

[SOLVED] 2 instances of obj_player after room_goto

M

mamacato

Guest
I have 2 playable rooms: rm_apartment, rm_yard. Both have o_player placed by hand on the map at the desired location. o_player has a draw event inside, if that changes anything. The draw event is for adding a shader when hurt. There used to be this code in the create event, but I commented it out a long time ago:
Code:
//set rm_00 start position
//room_start_pos_x = 68;
//room_start_pos_y = 63;
//room_start_facing = 1;
//x = room_start_pos_x
//y = room_start_pos_y
so, that should not be the issue. I also have rm_init where I have some game controller, but there's nothing in there. There used to this code in it, in room start event:
Code:
//player create
if !instance_exists(o_player)
{
   instance_create_layer(x,y, "Player", o_player);
}
But with, or without it, nothing changes.

I have 1 object 'go_to_yard' with o_player collision:
Code:
room_goto(rm_yard);
When I do go to the next room, another instance of o_player gets created somewhere near the top left corner of the map.

Any know what I'm overlooking here?
Thanks!
 
Either make the object non-persistent, or keep it persistent and get rid of the code that spawns the second player and instead set the first player's x,y coordinates to where you want it at the start of the room.
 
Top