Added shooter ship

This commit is contained in:
2ndbeam 2024-05-13 21:04:36 +03:00
commit ab3ac4af66
10 changed files with 232 additions and 4 deletions

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=9 format=3 uid="uid://pev6k21vqaem"]
[gd_scene load_steps=10 format=3 uid="uid://pev6k21vqaem"]
[ext_resource type="Script" path="res://scripts/Ship/ship.gd" id="1_82bba"]
[ext_resource type="PackedScene" uid="uid://bkd4gyhlota7l" path="res://scenes/Ships/Modules/Hulls/kamikaze_hull.tscn" id="2_165nu"]
@ -9,6 +9,19 @@
[ext_resource type="Script" path="res://scripts/State Machine/Kamikaze/WanderingState.gd" id="6_emcj1"]
[ext_resource type="Script" path="res://scripts/State Machine/Kamikaze/AttackState.gd" id="7_ilmkp"]
[sub_resource type="GDScript" id="GDScript_nif6i"]
resource_name = "health_shield_counter"
script/source = "extends Label
## Text with placeholder
@onready var unformatted_text: String = text
## Shortcut to get_parent().get_parent().get_parent()
@onready var ship: Ship = get_parent().get_parent().get_parent()
func _process(_delta):
text = unformatted_text.format([ship.hull.hp, ship.hull.max_hp, ship.shield.capacity, ship.shield.max_capacity])
"
[node name="KamikazeShip" type="Node2D"]
script = ExtResource("1_82bba")
@ -38,4 +51,24 @@ wait_time = 10.0
[node name="AttackState" type="Node" parent="StateTree"]
script = ExtResource("7_ilmkp")
[node name="StatHolder" type="Node" parent="."]
[node name="StatCarry" type="Node2D" parent="StatHolder"]
[node name="HealthShield" type="Label" parent="StatHolder/StatCarry"]
offset_left = -49.0
offset_top = -133.0
offset_right = 50.0
offset_bottom = -84.0
text = "{0}/{1} HP
{2}/{3} SP"
horizontal_alignment = 1
vertical_alignment = 1
script = SubResource("GDScript_nif6i")
[node name="RemoteTransform2D" type="RemoteTransform2D" parent="."]
remote_path = NodePath("../StatHolder/StatCarry")
update_rotation = false
update_scale = false
[connection signal="timeout" from="StateTree/WanderingState/UpdateDestination" to="StateTree/WanderingState" method="update_destination"]