cosmic/scenes/Ships/NPC Ships/shooter_ship.tscn
2024-06-08 13:21:45 +03:00

87 lines
3.1 KiB
Text

[gd_scene load_steps=11 format=3 uid="uid://yso8f0y5kg50"]
[ext_resource type="Script" path="res://scripts/Ship/ship.gd" id="1_o387g"]
[ext_resource type="PackedScene" uid="uid://bckgb423wsdrw" path="res://scenes/Ships/Modules/Hulls/shooter_hull.tscn" id="2_kthut"]
[ext_resource type="PackedScene" uid="uid://mw4kwxoeqch3" path="res://scenes/Ships/Modules/Engines/engine.tscn" id="3_ysnrn"]
[ext_resource type="PackedScene" uid="uid://bunboi5ouscw8" path="res://scenes/Ships/Modules/Shields/shield.tscn" id="4_5rkla"]
[ext_resource type="Script" path="res://scripts/Ship/weapons.gd" id="5_f305p"]
[ext_resource type="PackedScene" uid="uid://bf10g066l8grd" path="res://scenes/Ships/Modules/Weapons/laser.tscn" id="6_hun72"]
[ext_resource type="Script" path="res://scripts/State Machine/tree.gd" id="7_5uvtf"]
[ext_resource type="Script" path="res://scripts/State Machine/Kamikaze/WanderingState.gd" id="8_i8jwt"]
[ext_resource type="Script" path="res://scripts/State Machine/Shooter/AttackState.gd" id="9_0eak7"]
[sub_resource type="GDScript" id="GDScript_r7j0p"]
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([
round(ship.hull.hp * 100) / 100.0,
ship.hull.max_hp,
round(ship.shield.capacity * 100) / 100.0,
ship.shield.max_capacity
])
"
[node name="ShooterShip" type="Node2D"]
process_mode = 1
script = ExtResource("1_o387g")
id = "SHIP_SHOOTER"
[node name="HullHolder" type="Node" parent="."]
[node name="Hull" parent="HullHolder" instance=ExtResource("2_kthut")]
collision_mask = 3
[node name="Engine" parent="." instance=ExtResource("3_ysnrn")]
[node name="Shield" parent="." instance=ExtResource("4_5rkla")]
max_capacity = 3
[node name="Weapons" type="Node2D" parent="."]
script = ExtResource("5_f305p")
[node name="Laser" parent="Weapons" instance=ExtResource("6_hun72")]
position = Vector2(67, 0.5)
max_gun_rotation = 15.0
action_id = "shoot"
ammo_type = "n/a"
ammo_consumption = 0.0
[node name="StateTree" type="Node" parent="." node_paths=PackedStringArray("state")]
script = ExtResource("7_5uvtf")
state = NodePath("WanderingState")
[node name="WanderingState" type="Node" parent="StateTree"]
script = ExtResource("8_i8jwt")
[node name="UpdateDestination" type="Timer" parent="StateTree/WanderingState"]
wait_time = 10.0
[node name="AttackState" type="Node" parent="StateTree"]
script = ExtResource("9_0eak7")
[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_r7j0p")
[node name="RemoteTransform2D" type="RemoteTransform2D" parent="."]
remote_path = NodePath("../StatHolder/StatCarry")
update_rotation = false
update_scale = false