Godot Engine

Godot Engine

need help about changing scene.
Hello, I am making this game where you collect some cubes and i want to change the scene when my character collects cubes worth of 500 point(each cube is 50 point). I finish programing cubes,map,character movements and the sound but I can't find a way to change the scene when my character earns 500 point. You guys know a way to help me?
< >
Showing 1-5 of 5 comments
Matt [Linux] Feb 15, 2018 @ 11:26am 
func _my_level_was_completed(): get_tree().change_scene("res://levels/level2.tscn")

Godot [docs.godotengine.org]
Last edited by Matt [Linux]; Feb 15, 2018 @ 11:27am
Apollon Radson Feb 16, 2018 @ 4:28am 
Originally posted by GrimBean (XXXL):
func _my_level_was_completed(): get_tree().change_scene("res://levels/level2.tscn")

Godot [docs.godotengine.org]
Thank you very much for your answer but I know how to change the scene the thing I don’t know is how to change the scene when I have 500 point
Darknet Feb 16, 2018 @ 11:21am 
Try to used autoload to load script event to manage your events like points and global vars if your scene changes. You could call from there. Here more info about it http://docs.godotengine.org/en/3.0/getting_started/step_by_step/singletons_autoload.html?highlight=autoload
utetwo Jul 24, 2019 @ 3:40pm 
just use:


if points == 500:
get_tree().change_scene("res://levels/level2.tscn")

Put this in a process function like process(delta) so it will constantly update and check if theres 500 points.
Did i understand you?
You need to change scene right when player earn 500 points.
There is code for changing scenes:
get_tree().change_scene('res://yourscene')
You need to execute it when you earn 500, like here:
func _process(delta):
If points >=500:
get_tree().change_scene('res://yourscene')
< >
Showing 1-5 of 5 comments
Per page: 1530 50

Date Posted: Feb 15, 2018 @ 10:23am
Posts: 5