Added shooter ship
This commit is contained in:
parent
154da5104e
commit
ab3ac4af66
10 changed files with 232 additions and 4 deletions
14
scenes/Ships/Modules/Hulls/shooter_hull.tscn
Normal file
14
scenes/Ships/Modules/Hulls/shooter_hull.tscn
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://bckgb423wsdrw"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://bsu4eqwdfewwi" path="res://scenes/Ships/Modules/Hulls/hull.tscn" id="1_7i1ve"]
|
||||
[ext_resource type="Texture2D" uid="uid://bxtd2ij1dc1d3" path="res://sprites/shooter.png" id="2_gvwov"]
|
||||
|
||||
[node name="Hull" instance=ExtResource("1_7i1ve")]
|
||||
max_hp = 10.0
|
||||
|
||||
[node name="Sprite" parent="." index="0"]
|
||||
position = Vector2(0, 0.5)
|
||||
texture = ExtResource("2_gvwov")
|
||||
|
||||
[node name="Collision" parent="." index="1"]
|
||||
polygon = PackedVector2Array(-52.5, 15, -52.5, 51, -69.5, 61, -63.5, 71, -62.5, 71, 76.5, 1, 76.5, 0, -62.5, -70, -63.5, -70, -69.5, -60, -52.5, -50, -52.5, -14, -62.5, -14, -75.5, -28, -76.5, -28, -76.5, 29, -75.5, 29, -61.5, 15)
|
||||
|
|
@ -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"]
|
||||
|
|
|
|||
80
scenes/Ships/NPC Ships/shooter_ship.tscn
Normal file
80
scenes/Ships/NPC Ships/shooter_ship.tscn
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
[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([ship.hull.hp, ship.hull.max_hp, ship.shield.capacity, ship.shield.max_capacity])
|
||||
"
|
||||
|
||||
[node name="ShooterShip" type="Node2D"]
|
||||
process_mode = 1
|
||||
script = ExtResource("1_o387g")
|
||||
|
||||
[node name="HullHolder" type="Node" parent="."]
|
||||
|
||||
[node name="Hull" parent="HullHolder" instance=ExtResource("2_kthut")]
|
||||
|
||||
[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
|
||||
Loading…
Add table
Add a link
Reference in a new issue