MAD World

This commit is contained in:
MarcEricMartel 2023-06-11 16:30:38 -04:00
parent 0b735bc009
commit 46922f6a69
3 changed files with 86 additions and 1 deletions

View File

@ -28,7 +28,7 @@ public partial class mad : Control
_lbls[0].Set("visible", true);
_lbls.Remove(_lbls[0]);
} else {
var scene = GD.Load<PackedScene>("res://menu/start_game_menu.tscn");
var scene = GD.Load<PackedScene>("res://endings/the_end.tscn");
var instance = scene.Instantiate();
GetNode<Node>("/root/").AddChild(instance);
this.QueueFree();

34
endings/the_end.cs Normal file
View File

@ -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<PackedScene>("res://menu/start_game_menu.tscn");
var instance = scene.Instantiate();
GetNode<Node>("/root/").AddChild(instance);
this.QueueFree();
}
_tock++;
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
}
}

51
endings/the_end.tscn Normal file
View File

@ -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