Added passage length. Minor fixes

This commit is contained in:
2025-12-11 16:42:31 +03:00
parent 37d1289e2e
commit 0f317362dc
5 changed files with 20 additions and 4 deletions
+7 -2
View File
@@ -21,6 +21,8 @@ const WEAPONS := [
RAILGUN, SHRAPNEL, TESLA,
]
const SHADER_INTENSITY = "shader_parameter/intensity"
@export_range(0, 250) var acceleration : int = 0
@export_range(0, 250) var deceleration : int = 0
@@ -49,6 +51,9 @@ func _ready() -> void:
for slot in $WeaponSlots.get_children():
if slot is Node2D:
weapon_positions.append(slot.global_position - global_position)
armor_sprite.material.set(SHADER_INTENSITY, health.armor/float(health.max_armor))
shield_sprite.material.set(SHADER_INTENSITY, health.shield/float(health.max_shield))
func _physics_process(_delta: float) -> void:
@@ -109,12 +114,12 @@ func _add_weapon(weapon: AbstractWeapon, weapon_position: Vector2) -> void:
func _on_shield_updated(value: int, max_value: int) -> void:
shield_sprite.visible = value != 0
shield_sprite.material.set("shader_parameter/intensity", value/float(max_value))
shield_sprite.material.set(SHADER_INTENSITY, value/float(max_value))
func _on_armor_updated(value: int, max_value: int) -> void:
armor_sprite.visible = value != 0
armor_sprite.material.set("shader_parameter/intensity", value/float(max_value))
armor_sprite.material.set(SHADER_INTENSITY, value/float(max_value))
func _on_hull_updated(_value: int, _max_value: int) -> void:
+1 -1
View File
@@ -36,7 +36,7 @@ material = SubResource("ShaderMaterial_bkxo4")
[node name="Health" parent="." instance=ExtResource("2_xxtvk")]
[node name="HeathBar" parent="." node_paths=PackedStringArray("health") instance=ExtResource("3_l62e5")]
z_index = 101
z_index = 51
health = NodePath("../Health")
[node name="WeaponSlots" type="Node2D" parent="."]