add more sounds, fix all stuff

This commit is contained in:
2026-01-11 03:34:29 +01:00
parent 9b55af2e67
commit 92ac3df666
50 changed files with 824 additions and 0 deletions

Binary file not shown.

View File

@@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://crqfgue87yg78"
path="res://.godot/imported/chirp1.mp3-2fcc2bbc421c13178124d4679154fa68.mp3str"
[deps]
source_file="res://assets/audio/sfx/nickes/ambience/bird1/chirp1.mp3"
dest_files=["res://.godot/imported/chirp1.mp3-2fcc2bbc421c13178124d4679154fa68.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View File

@@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://cqjp3361myyck"
path="res://.godot/imported/chirp2.mp3-f83feb252ebedc2d656dc2a5391d2ba7.mp3str"
[deps]
source_file="res://assets/audio/sfx/nickes/ambience/bird1/chirp2.mp3"
dest_files=["res://.godot/imported/chirp2.mp3-f83feb252ebedc2d656dc2a5391d2ba7.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View File

@@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://dlybtsjtsbi7t"
path="res://.godot/imported/chirp3.mp3-fd7cf9cf71d9d41ef15eff6cf9a8e3c6.mp3str"
[deps]
source_file="res://assets/audio/sfx/nickes/ambience/bird1/chirp3.mp3"
dest_files=["res://.godot/imported/chirp3.mp3-fd7cf9cf71d9d41ef15eff6cf9a8e3c6.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View File

@@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://c21d0m2wgd7t5"
path="res://.godot/imported/chirp4.mp3-768e29d92aa8621da2d85a20c751019f.mp3str"
[deps]
source_file="res://assets/audio/sfx/nickes/ambience/bird1/chirp4.mp3"
dest_files=["res://.godot/imported/chirp4.mp3-768e29d92aa8621da2d85a20c751019f.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View File

@@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://xm83cr1osy5r"
path="res://.godot/imported/chirp5.mp3-3629f1c329b809a4822ba4b53aa385d3.mp3str"
[deps]
source_file="res://assets/audio/sfx/nickes/ambience/bird1/chirp5.mp3"
dest_files=["res://.godot/imported/chirp5.mp3-3629f1c329b809a4822ba4b53aa385d3.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View File

@@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://2muf6nawe0v3"
path="res://.godot/imported/chirp6.mp3-568f3e801c8060821eb00972abf2bfa3.mp3str"
[deps]
source_file="res://assets/audio/sfx/nickes/ambience/bird1/chirp6.mp3"
dest_files=["res://.godot/imported/chirp6.mp3-568f3e801c8060821eb00972abf2bfa3.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View File

@@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://77y7qepmv63l"
path="res://.godot/imported/chirp7.mp3-35d38f5349f8340fc84784b1dacc453d.mp3str"
[deps]
source_file="res://assets/audio/sfx/nickes/ambience/bird1/chirp7.mp3"
dest_files=["res://.godot/imported/chirp7.mp3-35d38f5349f8340fc84784b1dacc453d.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View File

@@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://de4xc4mx7jpdc"
path="res://.godot/imported/chirp8.mp3-bd2c27cfc935dc77fabc8fab64bd0323.mp3str"
[deps]
source_file="res://assets/audio/sfx/nickes/ambience/bird1/chirp8.mp3"
dest_files=["res://.godot/imported/chirp8.mp3-bd2c27cfc935dc77fabc8fab64bd0323.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View File

@@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://c0drxw3ssu6vj"
path="res://.godot/imported/chirp9.mp3-96c6b5573734daf0c81b2dec3254f306.mp3str"
[deps]
source_file="res://assets/audio/sfx/nickes/ambience/bird1/chirp9.mp3"
dest_files=["res://.godot/imported/chirp9.mp3-96c6b5573734daf0c81b2dec3254f306.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View File

@@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://bj46dpkq6xtin"
path="res://.godot/imported/meow1.wav.wav.mp3-56c881307d388c14504d6b75a6007665.mp3str"
[deps]
source_file="res://assets/audio/sfx/nickes/cat/meow1.wav.wav.mp3"
dest_files=["res://.godot/imported/meow1.wav.wav.mp3-56c881307d388c14504d6b75a6007665.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View File

@@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://c1vndwaq52odx"
path="res://.godot/imported/meow2.wav.wav.mp3-edb5cf2e59e95eb95f574c12300caa00.mp3str"
[deps]
source_file="res://assets/audio/sfx/nickes/cat/meow2.wav.wav.mp3"
dest_files=["res://.godot/imported/meow2.wav.wav.mp3-edb5cf2e59e95eb95f574c12300caa00.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View File

@@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://dv2aqt5fv05d5"
path="res://.godot/imported/meow3.wav.wav.mp3-e08a0581b5315887deef545dc3eadb4f.mp3str"
[deps]
source_file="res://assets/audio/sfx/nickes/cat/meow3.wav.wav.mp3"
dest_files=["res://.godot/imported/meow3.wav.wav.mp3-e08a0581b5315887deef545dc3eadb4f.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View File

@@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://busmfg57pdcux"
path="res://.godot/imported/meow4.wav.wav.mp3-a5e4b2d6ec5729a2090ddda46821d891.mp3str"
[deps]
source_file="res://assets/audio/sfx/nickes/cat/meow4.wav.wav.mp3"
dest_files=["res://.godot/imported/meow4.wav.wav.mp3-a5e4b2d6ec5729a2090ddda46821d891.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View File

@@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://b3pow1iyk15q"
path="res://.godot/imported/meow5.wav.wav.mp3-4aacaffb81ccbf80c43041fb7469454d.mp3str"
[deps]
source_file="res://assets/audio/sfx/nickes/cat/meow5.wav.wav.mp3"
dest_files=["res://.godot/imported/meow5.wav.wav.mp3-4aacaffb81ccbf80c43041fb7469454d.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View File

@@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://c3mxh07fyr760"
path="res://.godot/imported/clicky.mp3-d8bcb2843a8b16e5d011ae4eb03828bb.mp3str"
[deps]
source_file="res://assets/audio/sfx/nickes/clicky.mp3"
dest_files=["res://.godot/imported/clicky.mp3-d8bcb2843a8b16e5d011ae4eb03828bb.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View File

@@ -0,0 +1,19 @@
[remap]
importer="oggvorbisstr"
type="AudioStreamOggVorbis"
uid="uid://w6yon88kjfml"
path="res://.godot/imported/lift_sfx.ogg-82b36a3aa4dad3d7b0e4c70e4799984d.oggvorbisstr"
[deps]
source_file="res://assets/audio/sfx/nickes/lift_sfx.ogg"
dest_files=["res://.godot/imported/lift_sfx.ogg-82b36a3aa4dad3d7b0e4c70e4799984d.oggvorbisstr"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View File

@@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://c4rwowyss3hcx"
path="res://.godot/imported/open_door.mp3-acdf5d70690a7afac6760a9cc737d0eb.mp3str"
[deps]
source_file="res://assets/audio/sfx/nickes/open_door.mp3"
dest_files=["res://.godot/imported/open_door.mp3-acdf5d70690a7afac6760a9cc737d0eb.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View File

@@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://jjynn5whr6s3"
path="res://.godot/imported/pick_lock.mp3-3dd456978a7999686b9b7915cb14abf7.mp3str"
[deps]
source_file="res://assets/audio/sfx/nickes/pick_lock.mp3"
dest_files=["res://.godot/imported/pick_lock.mp3-3dd456978a7999686b9b7915cb14abf7.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View File

@@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://brgwctxtuokxx"
path="res://.godot/imported/pickup_armour.mp3-0b4f1b4428e36bd89c816d3be8d3c288.mp3str"
[deps]
source_file="res://assets/audio/sfx/nickes/pickup_armour.mp3"
dest_files=["res://.godot/imported/pickup_armour.mp3-0b4f1b4428e36bd89c816d3be8d3c288.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View File

@@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://c0dg7pc6tic1c"
path="res://.godot/imported/pickup_coin.mp3-2671d0f3a6f4822b1e0f573f78d36625.mp3str"
[deps]
source_file="res://assets/audio/sfx/nickes/pickup_coin.mp3"
dest_files=["res://.godot/imported/pickup_coin.mp3-2671d0f3a6f4822b1e0f573f78d36625.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View File

@@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://cil70fijdmtbl"
path="res://.godot/imported/thud_grass_sound.mp3-5bac907088602c05508c3c3e341e514f.mp3str"
[deps]
source_file="res://assets/audio/sfx/nickes/thud_grass_sound.mp3"
dest_files=["res://.godot/imported/thud_grass_sound.mp3-5bac907088602c05508c3c3e341e514f.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View File

@@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://c6gmimgvdksru"
path="res://.godot/imported/thud_grass_sound.wav-432ea2a262e2db07ba50627319d099b9.sample"
[deps]
source_file="res://assets/audio/sfx/nickes/thud_grass_sound.wav"
dest_files=["res://.godot/imported/thud_grass_sound.wav-432ea2a262e2db07ba50627319d099b9.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

Binary file not shown.

View File

@@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://cgjty3xygl3j6"
path="res://.godot/imported/win_jingle.mp3-3d25b2b793653d3a31cc81424d2f86ef.mp3str"
[deps]
source_file="res://assets/audio/sfx/nickes/win_jingle.mp3"
dest_files=["res://.godot/imported/win_jingle.mp3-3d25b2b793653d3a31cc81424d2f86ef.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

View File

@@ -0,0 +1,34 @@
[gd_scene format=3 uid="uid://cfku712xciyp"]
[ext_resource type="Script" uid="uid://dfigqc0flmid5" path="res://scripts/floor_switch.gd" id="1_p2yxv"]
[ext_resource type="AudioStream" uid="uid://brtf5pf2fny20" path="res://assets/audio/sfx/buttons/btn_click_02.wav.mp3" id="2_l24xk"]
[ext_resource type="AudioStream" uid="uid://b8hh30njhkpin" path="res://assets/audio/sfx/buttons/btn_click_06.wav.mp3" id="3_o6u0p"]
[ext_resource type="AudioStream" uid="uid://c3in48f5t0lyx" path="res://assets/audio/sfx/buttons/btn_click_05.wav.mp3" id="4_to70e"]
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_c655r"]
playback_mode = 1
streams_count = 2
stream_0/stream = ExtResource("2_l24xk")
stream_1/stream = ExtResource("3_o6u0p")
[sub_resource type="RectangleShape2D" id="RectangleShape2D_p2yxv"]
size = Vector2(16, 16)
[node name="FloorSwitch" type="Area2D" unique_id=581799630]
collision_mask = 11
script = ExtResource("1_p2yxv")
[node name="PressSwitch" type="AudioStreamPlayer2D" parent="." unique_id=594823346]
stream = SubResource("AudioStreamRandomizer_c655r")
max_distance = 963.0
attenuation = 8.574176
panning_strength = 1.04
[node name="ReleaseSwitch" type="AudioStreamPlayer2D" parent="." unique_id=957397628]
stream = ExtResource("4_to70e")
max_distance = 1530.0
attenuation = 8.574182
panning_strength = 1.05
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=361597954]
shape = SubResource("RectangleShape2D_p2yxv")

130
src/scenes/ingame_hud.tscn Normal file
View File

@@ -0,0 +1,130 @@
[gd_scene format=3 uid="uid://b2tyfgkroe0d8"]
[ext_resource type="Script" uid="uid://da5sp508nk1tx" path="res://scripts/ingame_hud.gd" id="1_hud_script"]
[ext_resource type="FontFile" uid="uid://bajcvmidrnc33" path="res://assets/fonts/standard_font.png" id="2_standard_font"]
[ext_resource type="Texture2D" uid="uid://dkisxs8ecfaul" path="res://assets/gfx/ui/hearts_filled.png" id="4_hearts_filled"]
[ext_resource type="Texture2D" uid="uid://dkpritx47nd4m" path="res://assets/gfx/pickups/items_n_shit.png" id="5_key_texture"]
[sub_resource type="Theme" id="Theme_standard_font"]
default_font = ExtResource("2_standard_font")
default_font_size = 10
[sub_resource type="AtlasTexture" id="AtlasTexture_kmtic"]
atlas = ExtResource("5_key_texture")
region = Rect2(160, 208, 16, 16)
margin = Rect2(0, -2, 0, 0)
[node name="IngameHUD" type="CanvasLayer" unique_id=846985801]
script = ExtResource("1_hud_script")
[node name="UpperLeft" type="MarginContainer" parent="." unique_id=22752255]
offset_right = 392.0
offset_bottom = 92.0
theme = SubResource("Theme_standard_font")
[node name="HBoxContainer" type="HBoxContainer" parent="UpperLeft" unique_id=339113149]
layout_mode = 2
[node name="VBoxContainerLIFE" type="VBoxContainer" parent="UpperLeft/HBoxContainer" unique_id=1514994213]
layout_mode = 2
size_flags_horizontal = 3
[node name="LabelLife" type="Label" parent="UpperLeft/HBoxContainer/VBoxContainerLIFE" unique_id=540685001]
layout_mode = 2
theme = SubResource("Theme_standard_font")
text = "- LIFE -"
horizontal_alignment = 1
[node name="TextureProgressBarHP" type="TextureProgressBar" parent="UpperLeft/HBoxContainer/VBoxContainerLIFE" unique_id=883573502]
layout_mode = 2
value = 100.0
texture_progress = ExtResource("4_hearts_filled")
[node name="VBoxContainerKeys" type="VBoxContainer" parent="UpperLeft/HBoxContainer" unique_id=1905937328]
layout_mode = 2
size_flags_horizontal = 3
[node name="LabelKeys" type="Label" parent="UpperLeft/HBoxContainer/VBoxContainerKeys" unique_id=869912308]
layout_mode = 2
theme = SubResource("Theme_standard_font")
text = "- KEYS -"
horizontal_alignment = 1
[node name="HBoxContainer" type="HBoxContainer" parent="UpperLeft/HBoxContainer/VBoxContainerKeys" unique_id=869912309]
layout_mode = 2
size_flags_horizontal = 4
[node name="TextureRectKey" type="TextureRect" parent="UpperLeft/HBoxContainer/VBoxContainerKeys/HBoxContainer" unique_id=869912310]
layout_mode = 2
texture = SubResource("AtlasTexture_kmtic")
stretch_mode = 5
[node name="LabelXKeys" type="Label" parent="UpperLeft/HBoxContainer/VBoxContainerKeys/HBoxContainer" unique_id=894452940]
layout_mode = 2
theme = SubResource("Theme_standard_font")
text = "x"
horizontal_alignment = 1
[node name="LabelKeysValue" type="Label" parent="UpperLeft/HBoxContainer/VBoxContainerKeys/HBoxContainer" unique_id=1691789757]
layout_mode = 2
theme = SubResource("Theme_standard_font")
text = "0"
horizontal_alignment = 1
[node name="VBoxContainerLevel" type="VBoxContainer" parent="UpperLeft/HBoxContainer" unique_id=1905937327]
layout_mode = 2
size_flags_horizontal = 3
[node name="LabelLevel" type="Label" parent="UpperLeft/HBoxContainer/VBoxContainerLevel" unique_id=869912307]
layout_mode = 2
theme = SubResource("Theme_standard_font")
text = "LEVEL"
horizontal_alignment = 1
[node name="LabelLevelValue" type="Label" parent="UpperLeft/HBoxContainer/VBoxContainerLevel" unique_id=1691789756]
layout_mode = 2
theme = SubResource("Theme_standard_font")
text = "1"
horizontal_alignment = 1
[node name="VBoxContainerTime" type="VBoxContainer" parent="UpperLeft/HBoxContainer" unique_id=2142702105]
layout_mode = 2
size_flags_horizontal = 3
[node name="LabelTime" type="Label" parent="UpperLeft/HBoxContainer/VBoxContainerTime" unique_id=793107824]
layout_mode = 2
theme = SubResource("Theme_standard_font")
text = "TIME"
horizontal_alignment = 1
[node name="LabelTimeValue" type="Label" parent="UpperLeft/HBoxContainer/VBoxContainerTime" unique_id=697137942]
layout_mode = 2
theme = SubResource("Theme_standard_font")
text = "00:00"
horizontal_alignment = 1
[node name="UpperRight" type="MarginContainer" parent="." unique_id=1261821969]
anchors_preset = 1
anchor_left = 1.0
anchor_right = 1.0
offset_left = -392.0
offset_bottom = 92.0
grow_horizontal = 0
theme = SubResource("Theme_standard_font")
[node name="HBoxContainer" type="HBoxContainer" parent="UpperRight" unique_id=332290975]
layout_mode = 2
[node name="VBoxContainerBoss" type="VBoxContainer" parent="UpperRight/HBoxContainer" unique_id=1933444957]
layout_mode = 2
size_flags_horizontal = 3
[node name="LabelBoss" type="Label" parent="UpperRight/HBoxContainer/VBoxContainerBoss" unique_id=1807484686]
layout_mode = 2
theme = SubResource("Theme_standard_font")
text = "BOSS"
horizontal_alignment = 1
[node name="TextureProgressBarBossHP" type="TextureProgressBar" parent="UpperRight/HBoxContainer/VBoxContainerBoss" unique_id=1266602557]
layout_mode = 2
texture_progress = ExtResource("4_hearts_filled")

217
src/scripts/ingame_hud.gd Normal file
View File

@@ -0,0 +1,217 @@
extends CanvasLayer
# Ingame HUD - Displays player health, level, time, and boss health
var label_life: Label = null
var texture_progress_bar_hp: TextureProgressBar = null
var label_keys: Label = null
var label_keys_value: Label = null
var label_level: Label = null
var label_level_value: Label = null
var label_time: Label = null
var label_time_value: Label = null
var label_boss: Label = null
var texture_progress_bar_boss_hp: TextureProgressBar = null
var game_world: Node = null
var local_player: Node = null
var level_start_time: float = 0.0
var player_search_attempts: int = 0
var max_player_search_attempts: int = 100 # Limit retries to prevent infinite recursion
var timer_running: bool = true # Flag to stop/start timer
func _ready():
print("IngameHUD: _ready() called")
# Find nodes safely (using get_node_or_null to avoid crashes)
label_life = get_node_or_null("UpperLeft/HBoxContainer/VBoxContainerLIFE/LabelLife")
texture_progress_bar_hp = get_node_or_null("UpperLeft/HBoxContainer/VBoxContainerLIFE/TextureProgressBarHP")
label_keys = get_node_or_null("UpperLeft/HBoxContainer/VBoxContainerKeys/LabelKeys")
label_keys_value = get_node_or_null("UpperLeft/HBoxContainer/VBoxContainerKeys/HBoxContainer/LabelKeysValue")
label_level = get_node_or_null("UpperLeft/HBoxContainer/VBoxContainerLevel/LabelLevel")
label_level_value = get_node_or_null("UpperLeft/HBoxContainer/VBoxContainerLevel/LabelLevelValue")
label_time = get_node_or_null("UpperLeft/HBoxContainer/VBoxContainerTime/LabelTime")
label_time_value = get_node_or_null("UpperLeft/HBoxContainer/VBoxContainerTime/LabelTimeValue")
label_boss = get_node_or_null("UpperRight/HBoxContainer/VBoxContainerBoss/LabelBoss")
texture_progress_bar_boss_hp = get_node_or_null("UpperRight/HBoxContainer/VBoxContainerBoss/TextureProgressBarBossHP")
# Debug: Check if nodes were found
if not label_time_value:
print("IngameHUD: ERROR - label_time_value not found!")
else:
print("IngameHUD: Nodes found successfully")
# Ensure visibility
visible = true
layer = 100 # High layer to ensure HUD is on top
# Find game world
game_world = get_tree().get_first_node_in_group("game_world")
if not game_world:
print("IngameHUD: WARNING - game_world not found in group")
# Initially hide boss health bar
if texture_progress_bar_boss_hp:
texture_progress_bar_boss_hp.visible = false
if label_boss:
label_boss.visible = false
# Start level timer
level_start_time = Time.get_ticks_msec() / 1000.0
# Find local player (with retry limit)
player_search_attempts = 0
_find_local_player()
func _find_local_player():
# Prevent infinite recursion
player_search_attempts += 1
if player_search_attempts > max_player_search_attempts:
print("IngameHUD: Warning - Could not find local player after ", max_player_search_attempts, " attempts. HUD will continue without player data.")
return
# Find the local player (first player with authority)
var players = get_tree().get_nodes_in_group("player")
# Check if we're in multiplayer mode
var is_multiplayer = multiplayer and multiplayer.has_multiplayer_peer()
if is_multiplayer:
# In multiplayer mode, find player with authority
for player in players:
if player.has_method("is_multiplayer_authority") and player.is_multiplayer_authority():
local_player = player
print("IngameHUD: Found local player")
return
else:
# In single-player mode, use first player
if players.size() > 0:
local_player = players[0]
print("IngameHUD: Found player (single-player mode)")
return
# If not found, try again later (but only if we haven't exceeded attempts)
if not local_player and player_search_attempts <= max_player_search_attempts:
call_deferred("_find_local_player")
func _process(_delta):
# Only update if nodes exist
if not label_time_value:
return # Nodes not initialized yet, skip updates
# Update player health
if local_player and is_instance_valid(local_player):
_update_player_health()
_update_keys_display()
# Update level display
_update_level_display()
# Update time display
_update_time_display()
# Update boss health (if boss exists)
_update_boss_health()
func _update_player_health():
if not local_player or not texture_progress_bar_hp:
return
var health = 0
var max_health = 100
# Try to get health from character_stats first (property always exists in player.gd)
if local_player.character_stats:
health = local_player.character_stats.hp
max_health = local_player.character_stats.maxhp
else:
# Fallback to direct properties (these are getters in player.gd, always available)
health = local_player.current_health
max_health = local_player.max_health
# Update progress bar
texture_progress_bar_hp.max_value = max_health
texture_progress_bar_hp.value = health
func _update_keys_display():
if not local_player or not label_keys_value:
return
# Get key count from player (keys property always exists in player.gd)
var key_count = local_player.keys
label_keys_value.text = str(key_count)
func _update_level_display():
if not label_level_value:
return
# current_level is always defined in game_world.gd
if game_world:
var level = game_world.current_level
label_level_value.text = str(level)
func _update_time_display():
if not label_time_value:
return
# Only update if timer is running
if not timer_running:
return
# Calculate elapsed time since level start
var current_time = Time.get_ticks_msec() / 1000.0
var elapsed_time = current_time - level_start_time
# Format as MM:SS
var minutes = int(elapsed_time / 60)
var seconds = int(elapsed_time) % 60
label_time_value.text = "%02d:%02d" % [minutes, seconds]
func get_level_time() -> float:
# Get the current level time (even if timer is stopped)
var current_time = Time.get_ticks_msec() / 1000.0
return current_time - level_start_time
func stop_timer():
# Stop the timer when level completes
timer_running = false
func start_timer():
# Start/reset the timer for new level
timer_running = true
level_start_time = Time.get_ticks_msec() / 1000.0
func _update_boss_health():
# Find boss enemy (if any)
var boss_enemy = null
var enemies = get_tree().get_nodes_in_group("enemy")
for enemy in enemies:
# Check if enemy is a boss (could check metadata or name)
if enemy.has_meta("is_boss") and enemy.get_meta("is_boss"):
boss_enemy = enemy
break
if boss_enemy and is_instance_valid(boss_enemy):
# Show boss health bar
if texture_progress_bar_boss_hp:
texture_progress_bar_boss_hp.visible = true
if label_boss:
label_boss.visible = true
# Update boss health (properties are always defined in enemy_base.gd)
var health = boss_enemy.current_health
var max_health = boss_enemy.max_health
if texture_progress_bar_boss_hp:
texture_progress_bar_boss_hp.max_value = max_health
texture_progress_bar_boss_hp.value = health
else:
# Hide boss health bar if no boss
if texture_progress_bar_boss_hp:
texture_progress_bar_boss_hp.visible = false
if label_boss:
label_boss.visible = false
func reset_level_timer():
# Reset timer when starting a new level
start_timer()

View File

@@ -0,0 +1 @@
uid://da5sp508nk1tx