Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Guilherme Henrique d |
I have a start menu, in start menu, the button “Start game” open the game to play.
button start game code:
get_tree().change_scene(“res://scenes/main.tscn”) # main.tscn is the game
when the player reach game over, the game return to start menu.
game over code:
get_tree().change_scene(“res://scenes/inicio.tscn”) # inicio.tscn is the start menu
but after the first game over, the buttons on start menu do not work anymore.
can you give us more details?
DodoIta | 2018-02-14 11:05
Can you elaborate more on your question? It seems like something else might be involved that might be interfering with the program.
SingingApple | 2018-02-14 13:51
I have 2 scenes that work like the menu and the game.
when I’m on the menu, when I click the “new game” button I execute the method
get_tree().change_scene("res://scenes/main.tscn")
to open the game.
When the game is over, I execute the method
get_tree().change_scene("res://scenes/inicio.tscn")
to go back to the menu.
After returning to the menu, the “new game” button no longer works, does not open the game. And i don’t know what i am doing wrong. I read about this method “change_scene” and i found some people saying: it’s just call change_scene(), and the method does the rest.
Guilherme Henrique d | 2018-02-15 16:00
Sorry for the stupidity, I solved the problem. The game was being paused when I went back to the other screen
Guilherme Henrique d | 2018-02-15 23:38
It’s great that you solved your problem! And it’s not about your stupidity. That’s the way how human beings learn, through mistakes.
SingingApple | 2018-02-16 11:21
yeah, you’re right, thank you for your time. I will continue exploring this incredible engine!
Guilherme Henrique d | 2018-02-16 11:24
Wish you luck on your journey ahead!
SingingApple | 2018-02-16 12:07
Same issue for me and same solution also.
I ran in exactly the same fault: changing to the main menu while paused.
ErdnussMaus | 2022-03-11 01:00