Deleting a scene from a variable

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Philter

At first maybe some explanations :slight_smile:
I have two levels loaded parallel at once. they both are loaded in my main scene under InGame:

Game <— script (Mainnode)
InGame (here I load my levels inside)

Inside Level2 is a trigger that sets a global variable (Globals.delete_level).
This variable defines the Level i want to remove. In my case now its Globals.delete_level = 1.

Now in the gamescript i want to remove the Level defined by the the variable and this is what I’m struggling with right now…

from my knowledge I would do it like this:

$InGame.get_node(“Level”, Globals.delete_level).queue_free()

but I get the following error:

Too many arguments for “get_node()” call. Expected at most 1.

I see the problem with the two arguments inside get_node() but i cant find a solution…
I hope someone can help me :slight_smile:
thank you for your answers

:bust_in_silhouette: Reply From: kidscancode

You need just one argument in get_node(): the string name of the node you’re getting.

You’re trying to make the string “Level1” out of “Level” and the value of Globals.delete_level. This is what + is for: