GML Visual Global variables in rooms

M

Matias Leonel Giollo

Guest
Hi, I have a problem, I want to put the ultimate score in another room which is the room of game over, but I can`t do it, I tried to do it with a global variable but it`s always on 0 at the game over room.

Any advice?

I`m using Game Maker 2 and drag and drop.
 
C

CodeBlack

Guest
Try to setup a invisible permanent object. When set to permanent a Object gets carried through all rooms without being destroyed. This way you can store the varaiables you need in it and carry them over to the next room.
 

Yal

🐧 *penguin noises*
GMC Elder
but it`s always on 0 at the game over room.
  • Make sure it's not set to 0 in every room, just the first.
  • Make sure it's actually set before you change rooms.
I often make a title screen room early on so the title screen object can initialize all global variables, that way I KNOW they're OK for any room with "game objects" in them.
 
M

Matias Leonel Giollo

Guest
Try to setup a invisible permanent object. When set to permanent a Object gets carried through all rooms without being destroyed. This way you can store the varaiables you need in it and carry them over to the next room.
Is there an option to be permanent, or I have to make and object and put it in every room?
 

Yal

🐧 *penguin noises*
GMC Elder
Is there an option to be permanent, or I have to make and object and put it in every room?
Yes, there's a checkbox called "persistent" that makes the object get carried over to the next room whenever you change rooms. (If you go back to the original room you won't get another copy of it, I've checked)
 
Top