Global variables

Hi guys, anyone can explain me how can i declare Global Variables to use as Points or lives for a game i’m working on, thanks:p

Well, an easy way to do this in a script would be to use the bge.logic module as a container for global variables, like player health or inventory (assuming that you don’t want it in the player object). You do this by setting the variable itself once:


bge.logic.variable = 1 # This initializes the variable if it doesn't exist, setting it to 1

Thanks SolarLune, that is what i needed

Better define one object as “liveHolder”.
Then place the current live in a property of this object.

Other objects can request the current live from it.