From 0f94363266dcfd7e032d9c8ad3d7d2ceb744fefb Mon Sep 17 00:00:00 2001 From: Chris Cromer Date: Tue, 30 Aug 2022 23:58:02 -0400 Subject: [PATCH] refactor game over screen --- godot/Main.tscn | 2 +- godot/gui/GameOver.tscn | 48 +++++++++++++++++++++++++++++++++++ godot/gui/GameOverScreen.gdns | 8 ++++++ 3 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 godot/gui/GameOver.tscn create mode 100644 godot/gui/GameOverScreen.gdns diff --git a/godot/Main.tscn b/godot/Main.tscn index 5babece..2cdfefa 100644 --- a/godot/Main.tscn +++ b/godot/Main.tscn @@ -2,7 +2,7 @@ [ext_resource path="res://Main.gdns" type="Script" id=1] [ext_resource path="res://levels/Prototype.tscn" type="PackedScene" id=2] -[ext_resource path="res://GUI/GameOver.tscn" type="PackedScene" id=3] +[ext_resource path="res://gui/GameOver.tscn" type="PackedScene" id=3] [node name="Main" type="Node"] pause_mode = 2 diff --git a/godot/gui/GameOver.tscn b/godot/gui/GameOver.tscn new file mode 100644 index 0000000..bff3216 --- /dev/null +++ b/godot/gui/GameOver.tscn @@ -0,0 +1,48 @@ +[gd_scene load_steps=7 format=2] + +[ext_resource path="res://assets/fonts/ttf/PixelOperator8.ttf" type="DynamicFontData" id=1] +[ext_resource path="res://assets/fonts/ttf/PixelOperatorHB8.ttf" type="DynamicFontData" id=2] +[ext_resource path="res://gui/GameOverScreen.gdns" type="Script" id=3] + +[sub_resource type="DynamicFont" id=1] +size = 50 +font_data = ExtResource( 1 ) + +[sub_resource type="DynamicFont" id=2] +font_data = ExtResource( 2 ) + +[sub_resource type="StyleBoxFlat" id=3] +bg_color = Color( 0.0705882, 0.917647, 0, 1 ) + +[node name="GameOver" type="CanvasLayer"] +script = ExtResource( 3 ) + +[node name="Control" type="Control" parent="."] +margin_right = 40.0 +margin_bottom = 40.0 + +[node name="ColorRect" type="ColorRect" parent="Control"] +margin_right = 512.0 +margin_bottom = 288.0 +rect_min_size = Vector2( 512, 288 ) +color = Color( 0, 0, 0, 1 ) + +[node name="Label" type="Label" parent="Control"] +margin_left = 66.0 +margin_top = 17.0 +margin_right = 456.0 +margin_bottom = 71.0 +custom_fonts/font = SubResource( 1 ) +text = "GAME OVER" +align = 1 + +[node name="RestartButton" type="Button" parent="Control"] +margin_left = 194.0 +margin_top = 150.0 +margin_right = 338.0 +margin_bottom = 180.0 +custom_fonts/font = SubResource( 2 ) +custom_styles/hover = SubResource( 3 ) +text = "REINICIAR" + +[connection signal="pressed" from="Control/RestartButton" to="." method="_on_restart_button_pressed"] diff --git a/godot/gui/GameOverScreen.gdns b/godot/gui/GameOverScreen.gdns new file mode 100644 index 0000000..750e9bf --- /dev/null +++ b/godot/gui/GameOverScreen.gdns @@ -0,0 +1,8 @@ +[gd_resource type="NativeScript" load_steps=2 format=2] + +[ext_resource path="res://gdnative/alai.tres" type="GDNativeLibrary" id=1] + +[resource] +resource_name = "GameOverScreen" +class_name = "GameOverScreen" +library = ExtResource( 1 )