0 votes

hi, im triying to make an gameoverscrene.
in the gameoverscreen, you can press R to respawn.
if i press R while the screen isnt visible i respawn also.

func process(delta):
if Input.is
actionpressed("rrespawn"):
gettree().changescene("res://planets/Spatial")

where and how do i have to write "and gameoverscreen.visible=true:" ?
cos it doesn't work if i set it after the ("r_respawn")

Godot version 3.3
in Engine by (213 points)

4 Answers

+1 vote

Is it a 3d game?
If yes then have you added any camera node? For 3d games its very important to have an camera3d node. So just try adding an camera 3d node to your scene

by (909 points)

i know that :)

0 votes

it's almost a complete 3d game. it's a first person game, and my problem is that i want the gameoverscrene in the same scene as the game itself. the gameoverscrene is in 2d and you see it, if you die.
I have programmed that when you press r, you respawn, and when you press q, you come to the main menu. but if you press r or q, even if you are not dead yet, you respawn or you will be brought to the main menu anyway. that's why I wanted to use "and" in the if statement, but I don't know how to do it. so i came here.

by (213 points)
+1 vote

Got it!
You mean 2d in 3d...
Watch this video and see if you can do it https://youtu.be/37hEX3Lrc0A
Or else right click on gameoverscreen and select save branch as scene. Then you need to use

get_tree().change_scene("res://gameoverscreen.tscn")
by (909 points)

ok, but i want that you see the 3d scene also after you die, like in minecraft.
i made also a red effect.

+1 vote

Hi!
I exactly got your answer. You just need to change the root to node rather than spatial. Then you can simply use

gameoverscreen.show()

Just after ("r_respawn")
This worked fine for me :)

by (909 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.