0
$\begingroup$

Here is what my code looks like.:

scene =bge.logic.getCurrentScene()
S = cont.actuators['s']
print('now')

scenes = beg.logic.getSceneList()
for scene in scenes:
    if scene.name ==  'scene':
        back = scene.objects['back']
        print("here")

if 1==1:
    back ['phase'] =2
    print('baby')
    S.activate

The only printed command is 'here' and I get an error that says I referenced 'back' before I assigned it. I'm trying to change a property called 'phase' that is on an object called 'back'. 'S' is an actuator that ends the overlay scene that the python running object called 'cube' is on. The scene is already loaded so that is not the problem. I'm just not sure where to go from here.

$\endgroup$
1
  • 1
    $\begingroup$ If that's what your code looks like, it won't run. beg is an undefined name (you probably mean bge), and If shouldn't be written with a captial letter. Take the time to create an example that actually works, if you want other people to spend time helping. $\endgroup$
    – dr. Sybren
    Commented Sep 20, 2016 at 21:00

1 Answer 1

0
$\begingroup$

Thanks fam, I found the code in another question.

import bge
from bge import logic

for scene in logic.getSceneList():
    if scene.name == 'ground':
        ground = scene

Back = ground.objects['back']

Back ['phase'] =3

This works to change back's property from another scene

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .