![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | FortunePilot |
Hey all,
I have created a class “Singleplayer_Game” that’s used to communicate between the current game and save files.
In this class, I have defined a function save_game()
that is used for saving specific information. Within this function, I call another function get_save_info()
that retrieves information from a child node of “Singleplayer_Game”. In order to give get_save_info()
the time it needs to collect the information and store it in a dictionary in “Singleplayer_Game”, I initially assumed I’d use a yield(timer) implementation, but I found that to be a hassle as I don’t exactly know how long it will take to collect that information. Since my project is in it’s very early stages, I will add tons of information that the game might need to save, which makes it take longer.
According to this code-example of the reply from Diean Jeans, it’d be possible to emit a signal at the end of a function, to let listeners know that function has finished executing. When I try this with a parent and a child node, it works splendid, like this:
Parent: emit_signal("example")
Child: yield(get_parent(), "example")
However, when I try to do this within the same class, like this;
emit_signal("example")
and yield(self, "example")
it doesn’t work, and never gets past the yield line.
Is there something I’m missing?
Thanks in advance!
~FortunePilot