0 votes

Hey,

Wanted to ask, as soon as i display game over i want all the back ground and foreground to go black...how can i do this.

I tried,
var colorblack = Color(0,0,0,1)
VisualServer.set
defaultclearcolor(color_black)

but it only sets the back ground black.

Thanks

in Engine by (73 points)

What do you mean by "foreground"? There is no foreground beyond what you actually put in your scene.

Yeah sorry thats what i mean. Over everything i have put...how can i make it all black..n just show gameover

Just add a sprite-node. In the dropdown menu of "Texture" select "New ImageTexture". Click on the little arrow on the right of the dropdown menu and change the size there.
it must be the last object in your scene tree, then it covers everything else.

1 Answer

+1 vote

If 2D, use a CanvasModulate node to tint everything to black (with a Tween, AnimationPlayer, etc.).

Add to another CanvasLayer the nodes you keep apart from the CanvasModulate effect.


Clear color is the color used to clear the video buffer.

by (7,830 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 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.