Thanks for the response, TwistedTwigleg.
1) Yeah, I've tried calling back scenes using get_tree().change_scene_to(), but it then doesn't run the code inside my player KinematicBody2D, so I enter the scene and it just leaves me with a lifeless sprite that won't move.
2)I think you can actually use hide() or show() in code to make sprites hide or show on command. I looked it up, but you can confirm if this works or not.
3) I made a main menu that knows when a button is clicked, and then (as I mentioned in my first thing), it leaves me with a lifeless sprite.
4) I have about 3 tutorials on how to send and receive signals XD, but if you could elaborate with what code I should be writing if I want to send or receive a specific message. I looked it up and it talked about a whole bunch of confusing things- I'll put it all here:
Emitting a signal from Primary.gd and receiving it in Secondary.gd can be done in the following way: first, you would have your two scripts written like this:
Primary.gd
extends Node
signal the_signal
# Then whatever code...
Secondary.gd
extends Node
# Note: inheriting Primary is not necessary for the signal to be received,
# so for this example I will not inherit it
func on_state_changed():
print("Update!")
Then you would have each of these scripts in two nodes, anywhere in your scene.
Now, for Secondary to receive the signal, it has to be connected with Primary.
You can do this from the scene tree editor: select the Primary node, then click on the Node dock. This dock should show all signals your node can emit, and you should see the_signal in them. Double-click on it, a dialog will open asking you which node should receive the signal. Select Secondary, and write the name of the function to call ("Method in Node"): on_state_changed, validate and they should be connected.
There is another way to do this connection, with code, using the _ready function. For example, in Secondary.gd, you can do this:
func _ready():
var primary = get_node("relative/path/to/Primary")
primary.connect("the_signal", self, "on_state_changed")
or, if you prefer doing it from Primary.gd:
func _ready():
var secondary = get_node("relative/path/to/Secondary")
connect("the_signal", secondary , "on_state_changed")
Finally, for this signal to do something, you have to emit it.
A simple way to test if it works is to emit the signal when you click a mouse button. To test this, you can use the _input function in Primary.gd:
func _input(event):
if event is InputEventMouseButton and event.pressed:
emit_signal("the_signal")
Thanks again for the response, I love learning new coding languages, frustrating and difficult though they are!