Add button returning to the main menu

This commit is contained in:
Mylloon 2023-02-25 19:01:04 +01:00
parent ce23571af9
commit 3c87d06d94
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 34 additions and 7 deletions

5
Scenes/GameOver.gd Executable file
View file

@ -0,0 +1,5 @@
extends Node2D
func _on_RestartButton_pressed():
get_tree().change_scene("res://Scenes/menu.tscn")

View file

@ -1,20 +1,42 @@
[gd_scene load_steps=3 format=2] [gd_scene load_steps=7 format=2]
[ext_resource path="res://Assets/windows.png" type="Texture" id=1] [ext_resource path="res://Assets/windows.png" type="Texture" id=1]
[ext_resource path="res://Assets/skin_assets/menu_font.tres" type="DynamicFont" id=2] [ext_resource path="res://Assets/skin_assets/menu_font.tres" type="DynamicFont" id=2]
[ext_resource path="res://Assets/tres_button/normal.tres" type="StyleBox" id=3]
[ext_resource path="res://Assets/tres_button/pressed.tres" type="StyleBox" id=4]
[ext_resource path="res://Assets/tres_button/hover.tres" type="StyleBox" id=5]
[ext_resource path="res://Scenes/GameOver.gd" type="Script" id=6]
[node name="Node2D" type="Node2D"] [node name="Node2D" type="Node2D"]
script = ExtResource( 6 )
[node name="Windows" type="Sprite" parent="."] [node name="Windows" type="Sprite" parent="."]
position = Vector2( 512, 360 ) position = Vector2( 512, 360 )
z_index = -2 z_index = -2
texture = ExtResource( 1 ) texture = ExtResource( 1 )
[node name="Label" type="Label" parent="."] [node name="LabelGameOver" type="Label" parent="."]
margin_left = 393.0 margin_left = 427.0
margin_top = 329.0 margin_top = 338.0
margin_right = 693.0 margin_right = 609.0
margin_bottom = 359.0 margin_bottom = 368.0
custom_colors/font_color = Color( 0, 0, 0, 1 ) custom_colors/font_color = Color( 0, 0, 0, 1 )
custom_fonts/font = ExtResource( 2 ) custom_fonts/font = ExtResource( 2 )
text = "RATIO GAME OVER" text = "GAME OVER"
[node name="RestartButton" type="Button" parent="."]
margin_left = 258.0
margin_top = 395.0
margin_right = 778.0
margin_bottom = 432.0
custom_colors/font_color = Color( 0.34902, 0.313726, 0.313726, 1 )
custom_fonts/font = ExtResource( 2 )
custom_styles/hover = ExtResource( 5 )
custom_styles/pressed = ExtResource( 4 )
custom_styles/normal = ExtResource( 3 )
text = "Revenir au menu principal"
__meta__ = {
"_edit_use_anchors_": true
}
[connection signal="pressed" from="RestartButton" to="." method="_on_RestartButton_pressed"]