Skip to content

Commit 6bd4acc

Browse files
committed
Added end win screen
1 parent c13cbb3 commit 6bd4acc

File tree

4 files changed

+22
-5
lines changed

4 files changed

+22
-5
lines changed

scenes/BattleDirector/scripts/BattleDirector.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ private void LostBattle()
217217
{
218218
GD.Print("Player is Dead");
219219
Audio.StreamPaused = true;
220-
AddChild(GD.Load<PackedScene>("res://scenes/UI/LoseScreen.tscn").Instantiate());
220+
AddChild(GD.Load<PackedScene>("res://scenes/UI/EndScreen.tscn").Instantiate());
221221
GetTree().Paused = true;
222222
}
223223

scenes/Maps/scripts/Cartographer.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ public override void _Ready()
1717
{
1818
DrawMap();
1919
GetViewport().GuiFocusChanged += UpdateFocus;
20+
if (StageProducer.CurRoom.Type == Stages.Boss && StageProducer.CurRoom.Children.Length == 0)
21+
{
22+
WinStage();
23+
}
2024
}
2125

2226
public override void _Process(double delta)
@@ -123,4 +127,14 @@ private void EnterStage(int roomIdx, Button button)
123127
tween.Finished += () =>
124128
GetNode<StageProducer>("/root/StageProducer").TransitionFromRoom(roomIdx);
125129
}
130+
131+
private void WinStage()
132+
{
133+
GD.Print("Player is Dead");
134+
EndScreen es = GD.Load<PackedScene>("res://scenes/UI/EndScreen.tscn")
135+
.Instantiate<EndScreen>();
136+
AddChild(es);
137+
es.TopLabel.Text = "You Win!";
138+
GetTree().Paused = true;
139+
}
126140
}
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
[gd_scene load_steps=2 format=3 uid="uid://hjho5n2f8rkf"]
22

3-
[ext_resource type="Script" path="res://scenes/UI/scripts/LoseScreen.cs" id="1_13iue"]
3+
[ext_resource type="Script" path="res://scenes/UI/scripts/EndScreen.cs" id="1_37m3y"]
44

5-
[node name="CanvasLayer" type="CanvasLayer" node_paths=PackedStringArray("buttons")]
5+
[node name="CanvasLayer" type="CanvasLayer" node_paths=PackedStringArray("buttons", "TopLabel")]
66
process_mode = 2
7-
script = ExtResource("1_13iue")
7+
script = ExtResource("1_37m3y")
88
buttons = [NodePath("MarginContainer2/VBoxContainer/MarginContainer/Restart"), NodePath("MarginContainer2/VBoxContainer/MarginContainer2/Title"), NodePath("MarginContainer2/VBoxContainer/MarginContainer3/Quit")]
9+
TopLabel = NodePath("MarginContainer2/VBoxContainer/TopLabel")
910

1011
[node name="ColorRect" type="ColorRect" parent="."]
1112
offset_right = 640.0
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
using FunkEngine;
33
using Godot;
44

5-
public partial class LoseScreen : CanvasLayer
5+
public partial class EndScreen : CanvasLayer
66
{
77
[Export]
88
private Button[] buttons;
99

10+
[Export] public Label TopLabel;
11+
1012
public override void _Ready()
1113
{
1214
buttons[0].Pressed += Restart;

0 commit comments

Comments
 (0)