A quick question: I am trying to use globalDict to store a reference to the last object detected with a connected radar sensor, but I am struggling with the syntax. Here is my code:
import bge own = bge.logic.getCurrentController().owner controller = bge.logic.getCurrentController().owner sen = controller.sensors["Radar"] locked_target = sen.hitObject bge.logic.globalDict["locked_target"] = sen.hitObject["locked_target"] print bge.logic.globalDict["locked_target"]
Can anyone shed any light onto what I should change? I am trying to understand how to store the reference to the last detected object - the best I wind up with is just storing the ‘locked target’ string and printing that.