godot-3-beginner-2d-platformer
godot-3-beginner-2d-platformer copied to clipboard
Bug if back main menu and click button play
func _unhandled_input(event: InputEvent) -> void: if event.is_action_pressed("pause") and pause_title.text != DIED_MESSAGE: self.paused = not paused scene_tree.set_input_as_handled()
Finished this tutorial a few days back, and ran into a similar issue. I noticed that someone commented on the YouTube video on how to fix it and it worked for me, so I'll reference it here as well, in case, someone comes here first to look for answers.
Commented by Краси Кирчев on YouTube
I had some issues with dying and the game being paused after that.
The dying sets
self.paused = true
. The retry button has code that turns pause off, but if you go to Main Menu, buttons aren't clickable. To fix this, you need to open theMainScreen.tscn
(and theEndScreen.tscn
) and make them process when paused just like we did for theUserInterface
. Issue doesn't stop here - game is still paused, and if you click Play on theMainScreen
, you start lvl1 but frozen mid-air. To fix this, you need to add "get_tree().paused = false
" or similar to the Play button's on-pressed function, just like we did in the Reply button.