time remaining in ending page

This commit is contained in:
Victor Turgeon 2023-10-11 10:37:23 -04:00
parent bdbced65ce
commit bd4e70f02b
4 changed files with 39 additions and 3 deletions

View File

@ -3,7 +3,7 @@
[ext_resource type="Script" path="res://Scripts/level.gd" id="1_0nmok"] [ext_resource type="Script" path="res://Scripts/level.gd" id="1_0nmok"]
[ext_resource type="PackedScene" uid="uid://b8s2seg2lf7wo" path="res://Scenes/Tilemaps/tileset_1.tscn" id="1_4n82n"] [ext_resource type="PackedScene" uid="uid://b8s2seg2lf7wo" path="res://Scenes/Tilemaps/tileset_1.tscn" id="1_4n82n"]
[ext_resource type="PackedScene" uid="uid://cl7w6ndvons1a" path="res://Scenes/Props/candle_1.tscn" id="2_5hdq4"] [ext_resource type="PackedScene" uid="uid://cl7w6ndvons1a" path="res://Scenes/Props/candle_1.tscn" id="2_5hdq4"]
[ext_resource type="PackedScene" uid="uid://cf7al5uln33rn" path="res://Scenes/Props/candle_2.tscn" id="2_o33c4"] [ext_resource type="PackedScene" uid="uid://by2xmwcng01uy" path="res://Scenes/Props/candle_2.tscn" id="2_o33c4"]
[ext_resource type="PackedScene" uid="uid://b5lnjonlf4i1b" path="res://Scenes/enemy.tscn" id="4_g0oey"] [ext_resource type="PackedScene" uid="uid://b5lnjonlf4i1b" path="res://Scenes/enemy.tscn" id="4_g0oey"]
[ext_resource type="PackedScene" uid="uid://0onqgygm832d" path="res://Scenes/Player/player.tscn" id="5_ik47y"] [ext_resource type="PackedScene" uid="uid://0onqgygm832d" path="res://Scenes/Player/player.tscn" id="5_ik47y"]
[ext_resource type="AudioStream" uid="uid://c3dy35dv368ft" path="res://Assets/Music/SisNeufPiDoozHuit.mp3" id="7_but47"] [ext_resource type="AudioStream" uid="uid://c3dy35dv368ft" path="res://Assets/Music/SisNeufPiDoozHuit.mp3" id="7_but47"]

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=87 format=3 uid="uid://drfn4qb06jfla"] [gd_scene load_steps=88 format=3 uid="uid://v0vtf1d1iusm"]
[ext_resource type="Script" path="res://Scripts/ending.gd" id="1_1hyxj"] [ext_resource type="Script" path="res://Scripts/ending.gd" id="1_1hyxj"]
[ext_resource type="PackedScene" uid="uid://b8s2seg2lf7wo" path="res://Scenes/Tilemaps/tileset_1.tscn" id="2_yeqls"] [ext_resource type="PackedScene" uid="uid://b8s2seg2lf7wo" path="res://Scenes/Tilemaps/tileset_1.tscn" id="2_yeqls"]
@ -11,6 +11,7 @@
[ext_resource type="Texture2D" uid="uid://ckeayob6k71b1" path="res://Assets/Witch/noBKG_WitchIdle_strip.png" id="7_wm35e"] [ext_resource type="Texture2D" uid="uid://ckeayob6k71b1" path="res://Assets/Witch/noBKG_WitchIdle_strip.png" id="7_wm35e"]
[ext_resource type="Texture2D" uid="uid://dyoeqid128gvx" path="res://Assets/Golem/noBKG_GolemIdle_strip.png" id="8_gwm2y"] [ext_resource type="Texture2D" uid="uid://dyoeqid128gvx" path="res://Assets/Golem/noBKG_GolemIdle_strip.png" id="8_gwm2y"]
[ext_resource type="Texture2D" uid="uid://b3a5g03ukunfa" path="res://Assets/Knight/noBKG_KnightIdle_strip.png" id="10_hwaw0"] [ext_resource type="Texture2D" uid="uid://b3a5g03ukunfa" path="res://Assets/Knight/noBKG_KnightIdle_strip.png" id="10_hwaw0"]
[ext_resource type="Texture2D" uid="uid://iy5flm8rgj60" path="res://Assets/Inverted hourglass1.png" id="12_iov5c"]
[sub_resource type="AtlasTexture" id="AtlasTexture_6btik"] [sub_resource type="AtlasTexture" id="AtlasTexture_6btik"]
atlas = ExtResource("5_pr1ps") atlas = ExtResource("5_pr1ps")
@ -831,4 +832,34 @@ stream = ExtResource("3_q0fqf")
pitch_scale = 0.4 pitch_scale = 0.4
autoplay = true autoplay = true
[node name="Time" type="Control" parent="."]
layout_mode = 3
anchors_preset = 0
offset_left = 320.0
offset_top = 96.0
offset_right = 320.0
offset_bottom = 96.0
size_flags_vertical = 3
[node name="HBoxContainer" type="HBoxContainer" parent="Time"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="Hourglass" type="TextureRect" parent="Time/HBoxContainer"]
layout_mode = 2
texture = ExtResource("12_iov5c")
expand_mode = 2
stretch_mode = 5
[node name="TimeLabel" type="Label" parent="Time/HBoxContainer"]
layout_mode = 2
theme = ExtResource("4_br77t")
text = "240 Seconds Remained"
vertical_alignment = 2
[connection signal="pressed" from="Quit" to="." method="_on_quit_pressed"] [connection signal="pressed" from="Quit" to="." method="_on_quit_pressed"]

View File

@ -7,13 +7,17 @@ var message: String = ""
var is_win: bool = true var is_win: bool = true
var army: Dictionary = {} var army: Dictionary = {}
var totalBlud: float = 0 var totalBlud: float = 0
var remainingTime: String = "0"
func _ready(): func _ready():
if is_win: if is_win:
$WinningEnemy.hide() $WinningEnemy.hide()
$DeadEnemy.show() $DeadEnemy.show()
$DeadEnemy.play("default") $DeadEnemy.play("default")
$Time.show()
$Time/HBoxContainer/TimeLabel.text = remainingTime + " Seconds Remained"
if !is_win: if !is_win:
$Time.hide()
$WinningEnemy.show() $WinningEnemy.show()
$DeadEnemy.hide() $DeadEnemy.hide()
$WinningEnemy.play("default") $WinningEnemy.play("default")
@ -29,7 +33,7 @@ func _ready():
$TotalArmyComp/Separation/ArmyTotals/Wolves/AmtWolves.text = "0" if !army.has("Wolf") else str(army["Wolf"]) $TotalArmyComp/Separation/ArmyTotals/Wolves/AmtWolves.text = "0" if !army.has("Wolf") else str(army["Wolf"])
$TotalArmyComp/Separation/ArmyTotals/Necromancers/AmtNecromancer.text = "0" if !army.has("Necromancer") else str(army["Necromancer"]) $TotalArmyComp/Separation/ArmyTotals/Necromancers/AmtNecromancer.text = "0" if !army.has("Necromancer") else str(army["Necromancer"])
$"TotalArmyComp/Separation/ArmyTotals/Pit Fiends/AmtPitFiend".text = "0" if !army.has("Pit Fiend") else str(army["Pit Fiend"]) $"TotalArmyComp/Separation/ArmyTotals/Pit Fiends/AmtPitFiend".text = "0" if !army.has("Pit Fiend") else str(army["Pit Fiend"])
$TotalArmyComp/Separation/TotalBludGen/AmtBlud.text = str(totalBlud) $TotalArmyComp/Separation/TotalBludGen/AmtBlud.text = str(floor(totalBlud))
func _on_quit_pressed(): func _on_quit_pressed():
get_tree().quit() get_tree().quit()

View File

@ -21,6 +21,7 @@ func _process(delta):
func win_screen(): func win_screen():
var enemy = $Enemy var enemy = $Enemy
var end = load("res://Scenes/ending.tscn").instantiate() var end = load("res://Scenes/ending.tscn").instantiate()
end.remainingTime = str(length - time - 1)
end.totalBlud = player.totalBludGenerated end.totalBlud = player.totalBludGenerated
end.army = player.allSpawnedMonsters end.army = player.allSpawnedMonsters
end.killcount = enemy.killcount end.killcount = enemy.killcount