I am currently trying to be able to switch between scenes. Unfortunately I can’t use the SetScene mode of the scene actuator, because I’m using a background scene.
The thing I want to achieve seems simple from a classic scripting view to me: I have an ‘empty’ that has an ‘always’ sensor with a dummy controller and a ‘scene actuator’ in ‘Add Background Scene’ mode with a certain scene selected. Now I want to change the background scene from within the underlayed scene. To do this I tried the following code (inspired by this) without success:
import bge gl = bge.logic sce = [sce for sce in gl.getSceneList() if sce.name == '_OVERLAY'] o = sce.objects def change(cont): own = cont.owner o['sceneLoader'].actuators['scene'].scene = own.get('goto')
How do I get this to work?
Is the way I’m doing it good practice?