So I’m making a UI for a game and I met a few problems, I solved most of them but this one got me.
I have this part of the script which causes the problem.
lif keyboard.getKeyStatus(bge.events.DOWNARROWKEY)==1: if own["OPM"]:
if own['OPM-LEVEL']==1:
own['OPM-LEVEL']=2
elif own['OPM-LEVEL']==2:
own['OPM-LEVEL']=3
elif own['OPM-LEVEL']==3:
own['OPM-LEVEL']=4
FadeObj = scene.objects[own["SELOPM"]]
FadeObj.worldPosition.y -= 0.95
elif own["NS"]:
if own['NGLEV']== 1:
own['NGLEV']== 2
VisObj = scene.objects[own["NGS1"]]
VisObj.visible = False
VisObj = scene.objects[own["NGS2"]]
VisObj.visible = True
elif own['NGLEV'] == 2:
own['NGLEV'] == 3
VisObj = scene.objects[own["NGS2"]]
VisObj.visible = False
VisObj = scene.objects[own["NGS3"]]
VisObj.visible = True
elif own['NGLEV']== 3:
own['NGLEV']== 4
VisObj = scene.objects[own["NGS3"]]
VisObj.visible = False
VisObj = scene.objects[own["NGS4"]]
VisObj.visible = True
elif keyboard.getKeyStatus(bge.events.UPARROWKEY)==1:
if own["OPM"]:
if own['OPM-LEVEL']==2:
own['OPM-LEVEL']=1
elif own['OPM-LEVEL']==3:
own['OPM-LEVEL']=2
elif own['OPM-LEVEL']==4:
own['OPM-LEVEL']=3
FadeObj = scene.objects[own["SELOPM"]]
FadeObj.worldPosition.y += 0.95
elif own["NS"]:
if own['NGLEV']==2:
own['NGLEV']==1
VisObj = scene.objects[own["NGS2"]]
VisObj.visible = False
VisObj = scene.objects[own["NGS1"]]
VisObj.visible = True
elif own['NGLEV']==3:
own['NGLEV']==2
VisObj = scene.objects[own["NGS3"]]
VisObj.visible = False
VisObj = scene.objects[own["NGS2"]]
VisObj.visible = True
elif own['NGLEV']==4:
own['NGLEV']==3
VisObj = scene.objects[own["NGS4"]]
VisObj.visible = False
VisObj = scene.objects[own["NGS3"]]
VisObj.visible = True
The ifs with the ‘OPM’ parts just work fine. They do what they should but when it comes to the ‘NS’ part it does nothing. It should make a few objects visible and others invisible and increase an integer.
OPM,NS=Boolean
NGLEV,OPM-LEVEL=Integer
NGS1-4,SELOPM=String with object name in them.
I can’t seem to find the problem. I don’t see any typos and the logic is okay too. Halp plox.