How to make signals communicate across scenes?

Godot Version

godot 4

Question

How to make signals communicate across scenes?
I have these two nodes, the player, and THEROCK (a random rock you can interact with). I had a bunch of signals between them, but then i remembered that people say its better to save each node as its own scene. But when i did that now I don’t have the option to connect signals between them.

1 Like

Thank you, but I’m really new to this so can you explain what all of this means and how i would adapt it to my situation?
These are my nodes:
Per (characterbody2d)

  • CollisionShape2D
  • AnimatedSprite2D
  • Camera2D
    THEROCK (staticbody2d)
  • InteractComp (area2d)
    • CollisionShape2D
    • Sprite2D
  • CollisionShape2D

And these are the signals I need:

Characterbody2D (named “Per”):
* interacted()

Area2D (named “InteractComp”)
* body_entered()
* body_exited()
I need interacted() to connect to connect to the interactcomp node and body_entered and body_exited to connect to the Characterbody2d node (Per)

What’s the main scene above this? My platform game has scenes such as “level 2” which then contain other scenes such as “player” and “coins”

I then use code like that:

func _on_body_entered(body):
	if body.name == ("player"):
		print("COIN")
		global.score += 10
		global.coins += 1
		print (global.score)
		print (global.coins)
		$AnimatedSprite2D.visible = false
		$CollisionShape2D.set_deferred("disabled",true)
		end_level()

I know that’s not a 100% answer to your question, but I’m happy to chat and help. :smile:

I’ve been learning Godot over the last month, and have built a few cute items. You can check out my YouTube channel and/or my itch.io for examples of my work.

Thanks for helping, I actually ended up fixing everything by right clicking each node in the main scene and clicking “editable children”

Thanks for helping, I actually ended up fixing everything by right clicking each node in the main scene and clicking “editable children”

1 Like

Nice. I’ve never used that so I’ll have a look at it.