Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | andreisp |
Basically i want to make the scenes change when a rigidbody enter an area. I have it done basically but my scene_count variable doesent change. Please help and tell me what i am doing wrong.
Here is the code:
extends Spatial
var current_level = 1
var scene_count = 1
var scene_state = false
Called when the node enters the scene tree for the first time.
func _ready():
$Panel.hide()
Called every frame. ‘delta’ is the elapsed time since the previous frame.
func _process(delta):
if Input.is_key_pressed(KEY_ENTER):
get_tree().reload_current_scene()
if Input.is_key_pressed(KEY_R):
get_tree().change_scene(“res://main.tscn”)
func _on_Area_body_entered(body):
print(scene_count)
if body is RigidBody:
get_tree().change_scene(“res://main” + str(scene_count) + “.tscn”)
scene_count += 1
if current_level == 3:
print(“Win”)
$Panel.show()
if get_tree().current_scene.get_name() == “main”:
current_level = 1
if get_tree().current_scene.get_name() == “main3”:
current_level = 3