From 46922f6a69ad24c3832ee3ab26bc365b4916b629 Mon Sep 17 00:00:00 2001 From: MarcEricMartel Date: Sun, 11 Jun 2023 16:30:38 -0400 Subject: [PATCH] MAD World --- endings/mad.cs | 2 +- endings/the_end.cs | 34 +++++++++++++++++++++++++++++ endings/the_end.tscn | 51 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 endings/the_end.cs create mode 100644 endings/the_end.tscn diff --git a/endings/mad.cs b/endings/mad.cs index 8d1e201..5956db3 100644 --- a/endings/mad.cs +++ b/endings/mad.cs @@ -28,7 +28,7 @@ public partial class mad : Control _lbls[0].Set("visible", true); _lbls.Remove(_lbls[0]); } else { - var scene = GD.Load("res://menu/start_game_menu.tscn"); + var scene = GD.Load("res://endings/the_end.tscn"); var instance = scene.Instantiate(); GetNode("/root/").AddChild(instance); this.QueueFree(); diff --git a/endings/the_end.cs b/endings/the_end.cs new file mode 100644 index 0000000..9f3038c --- /dev/null +++ b/endings/the_end.cs @@ -0,0 +1,34 @@ +using Godot; +using System; + +public partial class the_end : Control +{ + [Export] + private Label _lbl; + + [Export] + private Timer _tim; + // Called when the node enters the scene tree for the first time. + public override void _Ready() + { + _tim.Timeout += Tick; + } + + private int _tock = 0; + private void Tick() { + if (_tock == 0) + _lbl.Set("visible", true); + if (_tock == 4) { + var scene = GD.Load("res://menu/start_game_menu.tscn"); + var instance = scene.Instantiate(); + GetNode("/root/").AddChild(instance); + this.QueueFree(); + } + _tock++; + } + + // Called every frame. 'delta' is the elapsed time since the previous frame. + public override void _Process(double delta) + { + } +} diff --git a/endings/the_end.tscn b/endings/the_end.tscn new file mode 100644 index 0000000..91d13dc --- /dev/null +++ b/endings/the_end.tscn @@ -0,0 +1,51 @@ +[gd_scene load_steps=4 format=3 uid="uid://daa8munvmddws"] + +[ext_resource type="Script" path="res://endings/the_end.cs" id="1_wcvbh"] + +[sub_resource type="Gradient" id="Gradient_s0k3n"] +colors = PackedColorArray(0, 0, 0, 1, 0.194349, 0.194349, 0.194349, 1) + +[sub_resource type="GradientTexture1D" id="GradientTexture1D_cnbuo"] +gradient = SubResource("Gradient_s0k3n") + +[node name="the_end" type="Control" node_paths=PackedStringArray("_lbl", "_tim")] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_wcvbh") +_lbl = NodePath("Label") +_tim = NodePath("Timer") + +[node name="TextureRect" type="TextureRect" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +texture = SubResource("GradientTexture1D_cnbuo") + +[node name="Label" type="Label" parent="."] +visible = false +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -20.0 +offset_top = -11.5 +offset_right = 20.0 +offset_bottom = 11.5 +grow_horizontal = 2 +grow_vertical = 2 +text = " +“The nuclear arms race is like two sworn enemies standing waist deep in gasoline, one with three matches, the other with five.” + ― Carl Sagan " + +[node name="Timer" type="Timer" parent="."] +wait_time = 2.0 +autostart = true