From 3c87d06d946331e1930b7709ea9f968732e7757d Mon Sep 17 00:00:00 2001 From: Mylloon Date: Sat, 25 Feb 2023 19:01:04 +0100 Subject: [PATCH] Add button returning to the main menu --- Scenes/GameOver.gd | 5 +++++ Scenes/gameover.tscn | 36 +++++++++++++++++++++++++++++------- 2 files changed, 34 insertions(+), 7 deletions(-) create mode 100755 Scenes/GameOver.gd diff --git a/Scenes/GameOver.gd b/Scenes/GameOver.gd new file mode 100755 index 0000000..8d8a17d --- /dev/null +++ b/Scenes/GameOver.gd @@ -0,0 +1,5 @@ +extends Node2D + + +func _on_RestartButton_pressed(): + get_tree().change_scene("res://Scenes/menu.tscn") diff --git a/Scenes/gameover.tscn b/Scenes/gameover.tscn index 41420bc..1dfc627 100755 --- a/Scenes/gameover.tscn +++ b/Scenes/gameover.tscn @@ -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/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"] +script = ExtResource( 6 ) [node name="Windows" type="Sprite" parent="."] position = Vector2( 512, 360 ) z_index = -2 texture = ExtResource( 1 ) -[node name="Label" type="Label" parent="."] -margin_left = 393.0 -margin_top = 329.0 -margin_right = 693.0 -margin_bottom = 359.0 +[node name="LabelGameOver" type="Label" parent="."] +margin_left = 427.0 +margin_top = 338.0 +margin_right = 609.0 +margin_bottom = 368.0 custom_colors/font_color = Color( 0, 0, 0, 1 ) 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"]