Getting frustrated with Health extension on global player object

I am new to gdevelop and game dev. I am creating a standard top down RPG game. Every new part of the map is a new scene, in each scene I have dropped a copy of my player object. But I’ve found that everytime I go to a new scene it resets the health of the player to the default values.

I suspect it may have something to do with the player being a new instance or something on each scene.

What is the best way to have my player object available in each scene and shared health values.

All I can think of is to store them all in a variable before the scene changes and load them back in when the new scene starts but surely that’s not the best way

You’re correct. Global variables and storage are about the only things that are available in every scene. There should be a way to make objects and their behaviors global or at least the extension and variables.

In the meantime, you would need to store the value in a global variable or storage and then copy it back unless you create your own method for health that uses global variables.

The term global object only refers to the objects being in the editor regardless of the scene. Once added to a scene I don’t believe there’s a single difference.


Thanks for replying. I will try store everything in a global variable and see how that goes. Just more abstraction to deal with…

1 Like