Fixed hidden map control. Fixed shield

This commit is contained in:
2025-12-12 12:26:44 +03:00
parent ecec685f0f
commit 7422196588
3 changed files with 14 additions and 7 deletions
+5
View File
@@ -84,15 +84,20 @@ func _ready() -> void:
func _input(event: InputEvent) -> void: func _input(event: InputEvent) -> void:
if selected_sector == null: return if selected_sector == null: return
if not visible: return
if event.is_action_pressed("ui_left") and selected_sector.sector_to_left: if event.is_action_pressed("ui_left") and selected_sector.sector_to_left:
_set_selected_sector(selected_sector.sector_to_left) _set_selected_sector(selected_sector.sector_to_left)
if event.is_action_pressed("ui_right") and selected_sector.sector_to_right: if event.is_action_pressed("ui_right") and selected_sector.sector_to_right:
_set_selected_sector(selected_sector.sector_to_right) _set_selected_sector(selected_sector.sector_to_right)
if event.is_action_pressed("ui_up") and selected_sector.sector_above: if event.is_action_pressed("ui_up") and selected_sector.sector_above:
_set_selected_sector(selected_sector.sector_above) _set_selected_sector(selected_sector.sector_above)
if event.is_action_pressed("ui_down") and selected_sector.sector_below: if event.is_action_pressed("ui_down") and selected_sector.sector_below:
_set_selected_sector(selected_sector.sector_below) _set_selected_sector(selected_sector.sector_below)
if event.is_action_pressed("ui_accept"): if event.is_action_pressed("ui_accept"):
var selected_passage := _get_passage_to_sector(selected_sector) var selected_passage := _get_passage_to_sector(selected_sector)
if selected_passage != null: if selected_passage != null:
+7 -7
View File
@@ -45,15 +45,13 @@ var _weapons : Array[AbstractWeapon]
func _ready() -> void: func _ready() -> void:
shield_sprite.visible = health.shield != 0
armor_sprite.visible = health.armor != 0
for slot in $WeaponSlots.get_children(): for slot in $WeaponSlots.get_children():
if slot is Node2D: if slot is Node2D:
weapon_positions.append(slot.global_position - global_position) weapon_positions.append(slot.global_position - global_position)
armor_sprite.material.set(SHADER_INTENSITY, health.armor/float(health.max_armor)) _on_shield_updated(health.shield, health.max_shield)
shield_sprite.material.set(SHADER_INTENSITY, health.shield/float(health.max_shield)) _on_armor_updated(health.armor, health.max_armor)
_on_hull_updated(health.hull, health.max_hull)
func _physics_process(_delta: float) -> void: func _physics_process(_delta: float) -> void:
@@ -114,12 +112,14 @@ func _add_weapon(weapon: AbstractWeapon, weapon_position: Vector2) -> void:
func _on_shield_updated(value: int, max_value: int) -> void: func _on_shield_updated(value: int, max_value: int) -> void:
shield_sprite.visible = value != 0 shield_sprite.visible = value != 0
shield_sprite.material.set(SHADER_INTENSITY, value/float(max_value)) var intensity := value/float(max_value) if value != 0 else 0.0
shield_sprite.material.set(SHADER_INTENSITY, intensity)
func _on_armor_updated(value: int, max_value: int) -> void: func _on_armor_updated(value: int, max_value: int) -> void:
armor_sprite.visible = value != 0 armor_sprite.visible = value != 0
armor_sprite.material.set(SHADER_INTENSITY, value/float(max_value)) var intensity := value/float(max_value) if value != 0 else 0.0
armor_sprite.material.set(SHADER_INTENSITY, intensity)
func _on_hull_updated(_value: int, _max_value: int) -> void: func _on_hull_updated(_value: int, _max_value: int) -> void:
+2
View File
@@ -6,12 +6,14 @@
[ext_resource type="PackedScene" uid="uid://d2snum2pxc2ui" path="res://game/health_system/health_bar/heath_bar.tscn" id="3_l62e5"] [ext_resource type="PackedScene" uid="uid://d2snum2pxc2ui" path="res://game/health_system/health_bar/heath_bar.tscn" id="3_l62e5"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_dokxo"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_dokxo"]
resource_local_to_scene = true
shader = ExtResource("2_dokxo") shader = ExtResource("2_dokxo")
shader_parameter/speed = 0.0 shader_parameter/speed = 0.0
shader_parameter/scale = 20.0 shader_parameter/scale = 20.0
shader_parameter/intensity = 1.0 shader_parameter/intensity = 1.0
[sub_resource type="ShaderMaterial" id="ShaderMaterial_bkxo4"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_bkxo4"]
resource_local_to_scene = true
shader = ExtResource("2_dokxo") shader = ExtResource("2_dokxo")
shader_parameter/speed = 5.0 shader_parameter/speed = 5.0
shader_parameter/scale = 20.0 shader_parameter/scale = 20.0