
attrDict
- Returns the game object's internal python attribute dictionary.
- python dictionary
Note:
- A python dictionary is a data structure.
- The data is stored using a Key (ie. name) and a Value (ie. the data).

Sample Code: Part 1
# import bge
import bge
# get controller
cont = bge.logic.getCurrentController()
# get object that controller is attached to
obj = cont.owner
# Create an dictionary attribute
obj["Stats"] = { "Health" : 80,
"Armor" : 30,
"Type" : "Cleric",
"Sex" : "Male",
"Skill" : "Novice" }
"Type" : "Cleric",
"Sex" : "Male",
"Skill" : "Novice" }
Sample Code: Part 2
################## get game object's python attribute dictionary
# import bge
import bge
# get current scene
scene = bge.logic.getCurrentScene()
# get controller
cont = bge.logic.getCurrentController()
# get object that controller is attached to
obj = cont.owner
# get Stats from dictionary I created
stats = obj.attrDict["Stats"]
#get health
health = stats["Health"]