Godot Version
4.2.1
Question
every time my character dies it goes back to the play/quit screen, but whenever I click play it just flashes the game screen and then immediately goes back to the play/quit screen again and the only way to get it to stop doing this is to close the game completely and reopen it. any ideas?
try to debug it, add print("event_name")
to check if the buttons are configured correctly. Your screenshot is not enough to recognize the error.
This is what the debugger says. Idk how to print event name without an error saying identifier expected at the line.
The warnings are not critical, do what it says if the warnings bother you. (rename to _delta
)
example debug via print
func _ready():
print("main -> ready")
# more code
# .......
or check the docs, use breakpoint
This guide will give you an overview of the available debugging tools in the engine. Godot comes with a powerful debugger and profilers to track down bugs, inspect your game at runtime, monitor ess...
breakpoints don’t seem to help. All they do is give me a grey screen.
I’m doing this from a youtube tutorial with only one minor edit. this error started happening before the edit though.
Hard to say what it could be, can you compress the project with zip and share it on google drive for example? No zip file can be uploaded here in the forum.
yes, it’ just a sample project anyway.
Your link is not released for everyone, but I have requested it
because
if Game.playerHP <= 0:
print("Game.playerHP <= 0")
queue_free()
get_tree().change_scene_to_file("res://main.tscn")
in Player.gd
, and must ‘reset’ Game.playerHP
how do I reset it though?
Game.playerHP = 10
maybe here
if Game.playerHP <= 0:
print("Game.playerHP <= 0")
Game.playerHP = 10
queue_free()
get_tree().change_scene_to_file("res://main.tscn")
1 Like
That fixed it, thank you!
1 Like
system
Closed
January 23, 2024, 10:56pm
19
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.