From 8c87383e13205c506fd253e846f69e0b4af07432 Mon Sep 17 00:00:00 2001 From: LMBishop <13875753+LMBishop@users.noreply.github.com> Date: Sat, 29 Oct 2022 22:51:07 +0100 Subject: Shit --- HealthBar.gd | 2 ++ 1 file changed, 2 insertions(+) (limited to 'HealthBar.gd') diff --git a/HealthBar.gd b/HealthBar.gd index ae4ce42..ab9c68b 100644 --- a/HealthBar.gd +++ b/HealthBar.gd @@ -16,3 +16,5 @@ func _ready(): # pass func _on_player_hit(delta): value -= delta * 20 + if value == 0: + emit_signal("player_dead") -- cgit v1.2.3-70-g09d2 From 553e6d8a818a33195dbf1d01cb517e46fac7996e Mon Sep 17 00:00:00 2001 From: LMBishop <13875753+LMBishop@users.noreply.github.com> Date: Sat, 29 Oct 2022 23:05:38 +0100 Subject: Add death screen --- HUD.tscn | 10 +++++++++- HealthBar.gd | 4 ++-- Wordart.gd | 7 +++++++ assets/wordart.png | Bin 0 -> 990940 bytes project.godot | 4 ++++ 5 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 Wordart.gd create mode 100644 assets/wordart.png (limited to 'HealthBar.gd') diff --git a/HUD.tscn b/HUD.tscn index 49e6608..d89fb2a 100644 --- a/HUD.tscn +++ b/HUD.tscn @@ -1,6 +1,8 @@ -[gd_scene load_steps=2 format=2] +[gd_scene load_steps=4 format=2] [ext_resource path="res://HealthBar.gd" type="Script" id=1] +[ext_resource path="res://Wordart.gd" type="Script" id=2] +[ext_resource path="res://assets/wordart.png" type="Texture" id=3] [node name="HUD" type="CanvasLayer"] @@ -38,3 +40,9 @@ margin_left = 1272.0 margin_right = 1280.0 margin_bottom = 14.0 text = "0" + +[node name="Wordart" type="Sprite" parent="."] +position = Vector2( 626, 372 ) +scale = Vector2( 0.171967, 0.186029 ) +texture = ExtResource( 3 ) +script = ExtResource( 2 ) diff --git a/HealthBar.gd b/HealthBar.gd index ab9c68b..91a5b8e 100644 --- a/HealthBar.gd +++ b/HealthBar.gd @@ -4,11 +4,11 @@ extends ProgressBar # Declare member variables here. Examples: # var a = 2 # var b = "text" - +signal player_dead # Called when the node enters the scene tree for the first time. func _ready(): - pass # Replace with function body. + connect("player_dead", get_node("/root/Main/HUD/Wordart"), "_on_player_dead") # Called every frame. 'delta' is the elapsed time since the previous frame. diff --git a/Wordart.gd b/Wordart.gd new file mode 100644 index 0000000..6204e10 --- /dev/null +++ b/Wordart.gd @@ -0,0 +1,7 @@ +extends Sprite + +func _ready(): + visible = false + +func _on_player_dead(): + visible = true diff --git a/assets/wordart.png b/assets/wordart.png new file mode 100644 index 0000000..a4030d1 Binary files /dev/null and b/assets/wordart.png differ diff --git a/project.godot b/project.godot index a6eab52..035fc3a 100644 --- a/project.godot +++ b/project.godot @@ -25,6 +25,10 @@ window/size/height=720 window/stretch/mode="2d" window/stretch/aspect="keep" +[global] + +fonts=false + [gui] common/drop_mouse_on_gui_input_disabled=true -- cgit v1.2.3-70-g09d2