passing room creation code to objects

G

Gridma

Guest
hello,

i am trying to set the room state by using room creation code, want to change every children object by room setting

Code:
//room creation code

roomSize = 20;
roomState = "toxic";
then i put a room controller object in the room
but i can't refrence the variable nor in create event or room start event

someone mentioned about it while i googling "game maker get room creation code"
he said that "creation code executes only once when the room is active"
but i don't understand what event he was talking about

thanks for helping
 
Last edited by a moderator:

Yal

šŸ§ *penguin noises*
GMC Elder
You're defining those variables as local, you'd want to make them global to access them from other objects (since the room isn't an object instance you can't access its properties).

Code:
//room creation code

global.roomSize = 20;
global.roomState = "toxic";
Then just refer to them as global.roomSize or global.roomState from other objects as well and they'll be able to access them.
 
G

Gridma

Guest
You're defining those variables as local, you'd want to make them global to access them from other objects (since the room isn't an object instance you can't access its properties).

Code:
//room creation code

global.roomSize = 20;
global.roomState = "toxic";
Then just refer to them as global.roomSize or global.roomState from other objects as well and they'll be able to access them.
thanks, i thought it's available until leaving this room
global it is.

thanks for replying
 
Top