S
Shizuku
Guest
I have an object marked as persistent that manages transitions between the main menu and gameplay in my fighting game. When the player selects a character and stage, I use room_goto() to change the room to the stage they select and then attempt to create an instance of the character they've chosen.
For now, I'm using this code for testing purposes before I start adding content:
Despite the fact that the room test_fight has a layer called "Players", an error is thrown claiming that the layer does not exist. So then, I try to create a new layer in GML and create the instance on that layer like so:
When doing this, it doesn't throw errors anymore, but the instance doesn't appear to be created. When I create a layer in the character select room called "Players" and use my original code, no error is thrown and the object does not appear in test_fight. This leads me to believe that the manager object still exists on the character select room, even after executing room_goto(), and it's trying to create the instance there instead of in test_fight.
Why does the manager object not update immediately after using room_goto()? Is there any way to fix this problem, or should I just work around it?
For now, I'm using this code for testing purposes before I start adding content:
Code:
room_goto(test_fight);
var p1 = instance_create_layer(68, 93, "Players", testP1);
p1.player = 1;
Code:
room_goto(test_fight);
var newLayer = layer_create(0, "test");
var p1 = instance_create_layer(68, 93, "test", testP1);
p1.player = 1;
Why does the manager object not update immediately after using room_goto()? Is there any way to fix this problem, or should I just work around it?