Is there a way of calling functions through dirrent scenes?

next time also try @export

@export var score_board:Control

then in this Level_1 scene, in the Inspector dock, just click drag and drop the score_board to the coin when you created the coin by the editor
remember this only works for editor since you need to assign it via inspector dock
then just duplicate the scene to have the @export var score_board value to be applied in other coins in that level as well. i believe this is not the most effective way, this one and the one with Address Path or NodePath routing. but it will do for now
when you learn more of structuring the game

the way it works is by, look at where the script is in the scene tree
since i know the B Script is in Coins Node in level_1
so i need to go up to Coins, then go to level_1
hence why double …/…/
then i just enter the ScoreBoard since it’s our target
so why …/…/ScoreBoard works

wait should I drop the score board into the coin inspector?

Aha, I think I get it

no need to change it for now, i just saying if you dont know how to route, then you can also try @export, since it let you drag and drop the node you want that scene to have or use easily without needing to know which part it’s in and works if the target node path is shifted, let say move to other parent/child

1 Like

So if I wanted to get the tile map I would do: …/…/TileMap?
image

if it’s still from B Script of the Coin scene, then yes

Cool! Learned some new stuffs! Thanks.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.