I have 2 scenes. The first scene is my actual game. The second is an overlay, with a meter on it. Now this meter has a property that keeps on changing.
I need an object from the first scene to copy THAT property. Now, i know you can’t copy properties via logic bricks in different scenes, SO… i wrote this.
scene = GameLogic.getCurrentScene()
activeScenes = GameLogic.getSceneList()
objList = activeScenes.objects
meter = objList["Power"]
c = GameLogic.getCurrentController()
owner = c.owner
power = meter['Power']
copy = owner['Power']
copy = power
The object i want to copy from is called Power. Plus, both the properties are called Power.
I get this message on my screen:
AttributeError: ‘list’ object has no attribute ‘objects’
(Its refering to this line:
objList = activeScenes.objects)
activeScenes = GameLogic.getSceneList()
results in activeScenes which is now a list of scenes.
objList = activeScenes.objects
makes no sense as activeScenes is a list not a scene, so you get an error.
If you know the name of the overly scene you can do this:
overlayScene = GameLogic.getSceneList()[“otherScene”]
or
meterObject = GameLogic.getSceneList()[“otherScene”][“OBPower”]
or
powerProperty = GameLogic.getSceneList()[“otherSceneName”][“OBPower”][“Power”]