Closed Thomazino closed 4 years ago
Ok I added the spaces and I tried with signal "gameOver" to send the finalscore into Gameover scene without the global script. I took advantage of the SceneManager which had a condition on _deferred_goto_scene function that if i pass a param it will call an init function. So I created in Gameover's script this init function and I set the score there. Also I moved the yield function calling with the timer set in my new function gameOver but I tested it and there is no difference from before.
I merged the changes, thanks @Thomazino !
To solve the problem with the local variable lives I created the fuction get_lives() and this function returns from the node HUD the current_life_count added with 1. current_life_count is the animated lives but we need the actual lives and they are equal to current_life_count+1. So I replaced in script spaceship the local lives with my new function get_lives() and now the problem solved. As for the scene Gameover I created a new global script FinalScore and in function _on_game_over() from Spaceship's script i added in line 71 the setting of the final score. Now in scene Gameover I added a label and a ready function which assigns in label's text the final score that the player will see in the end.