|
globalDictglobalDictStores/saves the name and values of variables so they can be passed between scenes.Note:This is the Blender version of a python dictionary.Note:A dictionary is a python data structure. Different types (float, integer, string, dictionary, etc) of data can be stored in the same dictionary.Sample Code#create a dictionary for player 1 statsplayer1_Stats = { "Health" : 80,
"Armor" : 30,
"Class" : "Cleric" } #create a dictionary for player 2 statsplayer2_Stats = { "Health" : 60,
"Armor" : 90,
"Class" : "Warrior" } # save player 1 and player 2 dictionarys to the globalDictGameLogic.globalDict["player1"] = player1_StatsGameLogic.globalDict["player2"] = player2_Stats # get player 1 stats from the globalDictplayer1_stats = GameLogic.globalDict.get("player1")# get player 2 stats from the globalDictplayer2_stats = GameLogic.globalDict.get("player2") |