Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Mystile1369 | |
Old Version | Published before Godot 3 was released. |
If this has been discussed before… I’m sorry… I couldn’t find it.
Simple scene… a secret button and a dialog box. in the dialog box there is a button to lead to the next scene.
my plan is to have the button leading to the next scene to go to one scene if you didn’t find the secret… and to another if you did…
here are the scripts:
Script for secret:
extends TextureButton
func _ready():
pass
func _on_Secret_pressed():
Global.Bonus == 1
get_node("SamplePlayer").play("okay_1")
the sound plays when the button is pressed.
Code for the exit button:
extends Button
func _ready():
pass
func _on_Button_pressed():
if Global.Bonus == 1:
get_tree().change_scene("res://Assets/bonus.tscn")
if Global.Bonus == 0:
get_tree().change_scene("res://Assets/reg.tscn")
and my global script:
extends Node
var Bonus = 0
var Day = 0
var Sierra = 0
func _ready():
pass
Global is set to autoload and singleton…
regardless of what I do… the scene goes to “reg”
I’m not that proficient in this… but am trying to learn…
what am I forgetting here?