Fixed ship hidding

This commit is contained in:
2025-12-22 12:29:41 +03:00
parent 569f71cef8
commit 77981194dd
8 changed files with 57 additions and 57 deletions
+8 -8
View File
@@ -22,11 +22,12 @@ var _weapons : Array[AbstractWeapon]
@onready var ship : Node2D = $Ship @onready var ship : Node2D = $Ship
@onready var ship_sprite : Sprite2D = $ShipSprite
@onready var armor_sprite : Sprite2D = $ArmorSprite
@onready var shield_sprite : Sprite2D = $ShieldSprite
@onready var health_bar : HealthBar = $HealthBar @onready var ship_sprite : Sprite2D = $Ship/ShipSprite
@onready var armor_sprite : Sprite2D = $Ship/ArmorSprite
@onready var shield_sprite : Sprite2D = $Ship/ShieldSprite
@onready var health_bar : HealthBar = $Ship/HealthBar
@onready var debris_particles : GPUParticles2D = $DebrisParticles @onready var debris_particles : GPUParticles2D = $DebrisParticles
@@ -91,10 +92,9 @@ func _on_health_depleted() -> void:
for weapon in _weapons: for weapon in _weapons:
weapon.queue_free() weapon.queue_free()
_weapons.clear() _weapons.clear()
ship_sprite.hide() ship.hide()
armor_sprite.hide() collision_layer = 0
shield_sprite.hide() collision_mask = 0
health_bar.hide()
debris_particles.emitting = true debris_particles.emitting = true
+8 -8
View File
@@ -45,22 +45,20 @@ script = ExtResource("1_6isjb")
[node name="Ship" type="Node2D" parent="."] [node name="Ship" type="Node2D" parent="."]
[node name="ShipSprite" type="Sprite2D" parent="."] [node name="ShipSprite" type="Sprite2D" parent="Ship"]
[node name="ArmorSprite" type="Sprite2D" parent="."] [node name="ArmorSprite" type="Sprite2D" parent="Ship"]
material = SubResource("ShaderMaterial_dokxo") material = SubResource("ShaderMaterial_dokxo")
[node name="ShieldSprite" type="Sprite2D" parent="."] [node name="ShieldSprite" type="Sprite2D" parent="Ship"]
material = SubResource("ShaderMaterial_bkxo4") material = SubResource("ShaderMaterial_bkxo4")
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."] [node name="HealthBar" parent="Ship" node_paths=PackedStringArray("health") instance=ExtResource("3_l62e5")]
z_index = 51
health = NodePath("../../Health")
[node name="Health" parent="." instance=ExtResource("2_xxtvk")] [node name="Health" parent="." instance=ExtResource("2_xxtvk")]
[node name="HealthBar" parent="." node_paths=PackedStringArray("health") instance=ExtResource("3_l62e5")]
z_index = 51
health = NodePath("../Health")
[node name="WeaponSlots" type="Node2D" parent="."] [node name="WeaponSlots" type="Node2D" parent="."]
[node name="DebrisParticles" type="GPUParticles2D" parent="."] [node name="DebrisParticles" type="GPUParticles2D" parent="."]
@@ -71,5 +69,7 @@ one_shot = true
explosiveness = 1.0 explosiveness = 1.0
process_material = SubResource("ParticleProcessMaterial_dokxo") process_material = SubResource("ParticleProcessMaterial_dokxo")
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."]
[connection signal="depleted" from="Health" to="." method="_on_health_depleted"] [connection signal="depleted" from="Health" to="." method="_on_health_depleted"]
[connection signal="finished" from="DebrisParticles" to="." method="_on_debris_particles_finished"] [connection signal="finished" from="DebrisParticles" to="." method="_on_debris_particles_finished"]
@@ -25,10 +25,10 @@ collision_layer = 4
collision_mask = 6 collision_mask = 6
script = ExtResource("2_fwvrd") script = ExtResource("2_fwvrd")
[node name="ArmorSprite" parent="." index="1"] [node name="ArmorSprite" parent="Ship" index="1"]
material = SubResource("ShaderMaterial_dlmr1") material = SubResource("ShaderMaterial_dlmr1")
[node name="ShieldSprite" parent="." index="2"] [node name="ShieldSprite" parent="Ship" index="2"]
material = SubResource("ShaderMaterial_l8c0n") material = SubResource("ShaderMaterial_l8c0n")
[node name="EnemyController" parent="." index="4" node_paths=PackedStringArray("ship") instance=ExtResource("3_l8c0n")] [node name="EnemyController" parent="." index="4" node_paths=PackedStringArray("ship") instance=ExtResource("3_l8c0n")]
@@ -38,14 +38,14 @@ deceleration = 18
max_speed = 60 max_speed = 60
mass = 600 mass = 600
[node name="ShipSprite" parent="." index="0"] [node name="ShipSprite" parent="Ship" index="0"]
texture = SubResource("AtlasTexture_xqe8d") texture = SubResource("AtlasTexture_xqe8d")
[node name="ArmorSprite" parent="." index="1"] [node name="ArmorSprite" parent="Ship" index="1"]
material = SubResource("ShaderMaterial_c4do6") material = SubResource("ShaderMaterial_c4do6")
texture = SubResource("AtlasTexture_qawoi") texture = SubResource("AtlasTexture_qawoi")
[node name="ShieldSprite" parent="." index="2"] [node name="ShieldSprite" parent="Ship" index="2"]
material = SubResource("ShaderMaterial_6d574") material = SubResource("ShaderMaterial_6d574")
texture = SubResource("AtlasTexture_c4do6") texture = SubResource("AtlasTexture_c4do6")
@@ -58,7 +58,7 @@ rect = Rect2(-29, -21, 58, 42)
[node name="Health" parent="." index="6"] [node name="Health" parent="." index="6"]
max_hull = 200 max_hull = 200
[node name="HealthBar" parent="." index="7"] [node name="HealthBar" parent="Ship" index="7"]
offset_top = 27.0 offset_top = 27.0
offset_bottom = 27.0 offset_bottom = 27.0
@@ -38,14 +38,14 @@ deceleration = 46
max_speed = 92 max_speed = 92
mass = 250 mass = 250
[node name="ShipSprite" parent="." index="0"] [node name="ShipSprite" parent="Ship" index="0"]
texture = SubResource("AtlasTexture_d2xji") texture = SubResource("AtlasTexture_d2xji")
[node name="ArmorSprite" parent="." index="1"] [node name="ArmorSprite" parent="Ship" index="1"]
material = SubResource("ShaderMaterial_jorhn") material = SubResource("ShaderMaterial_jorhn")
texture = SubResource("AtlasTexture_om3xa") texture = SubResource("AtlasTexture_om3xa")
[node name="ShieldSprite" parent="." index="2"] [node name="ShieldSprite" parent="Ship" index="2"]
material = SubResource("ShaderMaterial_ren2c") material = SubResource("ShaderMaterial_ren2c")
texture = SubResource("AtlasTexture_jorhn") texture = SubResource("AtlasTexture_jorhn")
@@ -58,7 +58,7 @@ rect = Rect2(-13, -21, 26, 42)
[node name="Health" parent="." index="6"] [node name="Health" parent="." index="6"]
max_hull = 100 max_hull = 100
[node name="HealthBar" parent="." index="7"] [node name="HealthBar" parent="Ship" index="7"]
offset_top = 19.0 offset_top = 19.0
offset_bottom = 19.0 offset_bottom = 19.0
@@ -23,13 +23,13 @@ deceleration = 80
max_speed = 120 max_speed = 120
mass = 100 mass = 100
[node name="ShipSprite" parent="." index="0"] [node name="ShipSprite" parent="Ship" index="0"]
texture = SubResource("AtlasTexture_tb2nn") texture = SubResource("AtlasTexture_tb2nn")
[node name="ArmorSprite" parent="." index="1"] [node name="ArmorSprite" parent="Ship" index="1"]
texture = SubResource("AtlasTexture_3asrx") texture = SubResource("AtlasTexture_3asrx")
[node name="ShieldSprite" parent="." index="2"] [node name="ShieldSprite" parent="Ship" index="2"]
texture = SubResource("AtlasTexture_20te2") texture = SubResource("AtlasTexture_20te2")
[node name="CollisionPolygon2D" parent="." index="3"] [node name="CollisionPolygon2D" parent="." index="3"]
@@ -41,7 +41,7 @@ rect = Rect2(-13, -5, 26, 10)
[node name="Health" parent="." index="6"] [node name="Health" parent="." index="6"]
max_hull = 50 max_hull = 50
[node name="HealthBar" parent="." index="7"] [node name="HealthBar" parent="Ship" index="7"]
offset_top = 11.0 offset_top = 11.0
offset_bottom = 11.0 offset_bottom = 11.0
+1 -1
View File
@@ -20,7 +20,7 @@ var blink_charge: float:
@onready var blink_shadow : GPUParticles2D = $BlinkShadow @onready var blink_shadow : GPUParticles2D = $BlinkShadow
@onready var blink_charge_indicator : BlinkChargeIndicator = $BlinkChargeIndicator @onready var blink_charge_indicator : BlinkChargeIndicator = $Ship/BlinkChargeIndicator
func _ready() -> void: func _ready() -> void:
+26 -26
View File
@@ -56,17 +56,38 @@ deceleration = 46
max_speed = 92 max_speed = 92
mass = 250 mass = 250
[node name="ShipSprite" parent="." index="1"] [node name="ShipSprite" parent="Ship" index="0"]
texture = SubResource("AtlasTexture_4mjo1") texture = SubResource("AtlasTexture_4mjo1")
[node name="ArmorSprite" parent="." index="2"] [node name="ArmorSprite" parent="Ship" index="1"]
material = SubResource("ShaderMaterial_waejo") material = SubResource("ShaderMaterial_waejo")
texture = SubResource("AtlasTexture_uf2n1") texture = SubResource("AtlasTexture_uf2n1")
[node name="ShieldSprite" parent="." index="3"] [node name="ShieldSprite" parent="Ship" index="2"]
material = SubResource("ShaderMaterial_5xifi") material = SubResource("ShaderMaterial_5xifi")
texture = SubResource("AtlasTexture_ui1ht") texture = SubResource("AtlasTexture_ui1ht")
[node name="HealthBar" parent="Ship" index="3"]
offset_top = 19.0
offset_bottom = 19.0
[node name="BlinkChargeIndicator" parent="Ship" index="4" instance=ExtResource("5_uf2n1")]
position = Vector2(-11, 0)
[node name="Health" parent="." index="1"]
max_shield = 250
max_hull = 1000
[node name="First" type="Node2D" parent="WeaponSlots" index="0"]
position = Vector2(-2, -8)
[node name="Second" type="Node2D" parent="WeaponSlots" index="1"]
position = Vector2(-2, 8)
[node name="DebrisParticles" parent="." index="3"]
amount = 16
texture = ExtResource("7_waejo")
[node name="PlayerController" parent="." index="4" instance=ExtResource("3_4mjo1")] [node name="PlayerController" parent="." index="4" instance=ExtResource("3_4mjo1")]
[node name="CollisionPolygon2D" parent="." index="5"] [node name="CollisionPolygon2D" parent="." index="5"]
@@ -85,29 +106,8 @@ lifetime = 0.1
one_shot = true one_shot = true
process_material = SubResource("ParticleProcessMaterial_pjmi2") process_material = SubResource("ParticleProcessMaterial_pjmi2")
[node name="Health" parent="." index="8"]
max_shield = 250
max_hull = 1000
[node name="HealthBar" parent="." index="9"]
offset_top = 19.0
offset_bottom = 19.0
[node name="BlinkChargeIndicator" parent="." index="10" instance=ExtResource("5_uf2n1")]
position = Vector2(-11, 0)
[node name="First" type="Node2D" parent="WeaponSlots" index="0"]
position = Vector2(-2, -8)
[node name="Second" type="Node2D" parent="WeaponSlots" index="1"]
position = Vector2(-2, 8)
[node name="DebrisParticles" parent="." index="12"]
amount = 16
texture = ExtResource("7_waejo")
[connection signal="accelerate" from="PlayerController" to="." method="accelerate"]
[connection signal="blink" from="PlayerController" to="." method="_blink"]
[connection signal="armor_updated" from="Health" to="." method="_on_armor_updated"] [connection signal="armor_updated" from="Health" to="." method="_on_armor_updated"]
[connection signal="hull_updated" from="Health" to="." method="_on_hull_updated"] [connection signal="hull_updated" from="Health" to="." method="_on_hull_updated"]
[connection signal="shield_updated" from="Health" to="." method="_on_shield_updated"] [connection signal="shield_updated" from="Health" to="." method="_on_shield_updated"]
[connection signal="accelerate" from="PlayerController" to="." method="accelerate"]
[connection signal="blink" from="PlayerController" to="." method="_blink"]