Several issues with HUD

I have a character creator with an HUD. I have several sub-menus, like size, color, stats and armor. Every sub-menu is a separate scene, and displayed via an “Overlay Scene” actuator, which is triggered by a message when a button is clicked. Now my problem is that I need some scenes to receive some information when inactive - in my case, when the character size (property) is increased, the size of the strength bar (property) in the “Stats” submenu is automatically increased as well. This doesn’t work, however, because the Stats scene is inactive at the time. Is there a way to fix this?
My overlay scene method is also quite a brick mess, is there a better way to do it?

Thanks in advance.

You can have variables at the gamelogic level. (Not sure what the ‘official’ term for this is. I’m self taught.)



from bge import logic as g

g.character_size = 100


Those are always available. However, I’ve found they can cause some issues when ending or restarting scenes. On scene restart I have an init step that resets all of the variables I have modified this way.

thanks. i don’t know what this code means, but i’ll try it out. in this case, i assume character_size is the property?

Ouch, don’t insert things straight into game logic. There is a special global dictionary for that.


import bge

global_dict = bge.logic.globalDict
global_dict['character_size'] = 100

What is the reason for avoiding this? I only started doing it after I noticed a lot of the filters that I found on this site do it.

You don’t put things in bge.logic because your information has nothing to do with the game logic behind the scenes stuff itself.
And 2D filters are different.

To be honest, I’d be tempted to make a class bge.game, which holds everything about the current game-state, so scores, menu position, settings etc.

If python is too problematic for you :

… i don’t know what this code means, but i’ll try it out. in this case, i assume character_size is the property?

Use a control scene which is always active. You can use a or various controller objects to save data into their properties.
When a new scene is activated, just have an object copy the properties in the objects from the control scene!
Good luck!