Hi,
I have two scenes, scene1 and scene2. scene2 is an overlay scene. Now I want to get the property of an object of the scene2 from scene1. How do I do it. The object name is e.g. OBRock and it has a property call Mull(boolean). I want to toggle the bool Mull from an object of scene1. Click the object of the scene1 and change the property of the scene2 object.
import GameLogic
def change(cont):
own = cont.owner
scene = getSceneByName("scene1")
if scene is None:
return
otherObj = scene["OBRock"]
otherObj["whatever"] = not otherObj["whatever"]
def getSceneByName(sceneName):
scenes = GameLogic.getSceneList()
for scene in scenes:
if scene.name == sceneName:
return scene
Another option:
send a message e.g. “changeXYZ”
have a sensor on Rock listening on “changeXYZ”. When receiving such a message toggle the property.
Thanks for the reply. I tried the message sensors but I could not make it work. Could you kindly explain it a little so that I could get some idea. I must create it using python.
Could you use globaldict (I think that’s what its called) to communicate properties? I have a similar problem in that I wanted a hud to read the velocity of the player from the main scene to the overlay.