Peashooters

This commit is contained in:
Rendo 2025-08-09 21:35:02 +05:00
commit 68cfe89f1d
47 changed files with 1571 additions and 279 deletions

View file

@ -0,0 +1,186 @@
[gd_scene load_steps=23 format=3 uid="uid://bxs34adppsh5e"]
[ext_resource type="Texture2D" uid="uid://cksryh4w5dbbx" path="res://assets/sprites/atlases/plants/peashooter.png" id="2_4l0yo"]
[ext_resource type="Script" uid="uid://bwdvaov8sse4k" path="res://scripts/entities/entity.gd" id="2_pk084"]
[ext_resource type="Script" uid="uid://be5rfbbl5xgeh" path="res://scripts/components/generic_collider.gd" id="3_2lnl7"]
[ext_resource type="Script" uid="uid://cbmavbe4xd0j2" path="res://scripts/speed_controlled/speed_controlled_animation_tree.gd" id="3_gkdjr"]
[ext_resource type="Script" uid="uid://cbudgx741oxtc" path="res://scripts/components/generic_hurtbox.gd" id="5_gkdjr"]
[ext_resource type="Script" uid="uid://cjulv0bt6deps" path="res://scripts/components/field_segment_shape.gd" id="6_tf8ra"]
[ext_resource type="Script" uid="uid://b0ka8lb5kl1fd" path="res://scripts/components/controllers/plants/peashooter_controller.gd" id="8_0ridr"]
[ext_resource type="Script" uid="uid://d17rkta3k73jx" path="res://scripts/components/plant_death_handler.gd" id="8_6jrfv"]
[sub_resource type="Animation" id="Animation_tf8ra"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [0]
}
[sub_resource type="Animation" id="Animation_gkdjr"]
resource_name = "idle"
length = 0.833342
loop_mode = 1
step = 0.0833333
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.0833333, 0.166667, 0.25, 0.333333, 0.416667, 0.5, 0.583333, 0.666667, 0.75),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
}
[sub_resource type="Animation" id="Animation_4l0yo"]
resource_name = "shoot"
length = 0.666675
step = 0.0833333
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.0833333, 0.166667, 0.25, 0.333333, 0.416667, 0.5, 0.583333),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [10, 11, 12, 13, 14, 15, 16, 17]
}
tracks/1/type = "method"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Controller")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0.333333),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"shoot"
}]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_0ridr"]
_data = {
&"RESET": SubResource("Animation_tf8ra"),
&"idle": SubResource("Animation_gkdjr"),
&"shoot": SubResource("Animation_4l0yo")
}
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_0ridr"]
animation = &"idle"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_6jrfv"]
animation = &"shoot"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_0l7qe"]
advance_mode = 2
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_3wvhk"]
advance_mode = 2
advance_expression = "is_shooting()"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_hlvcn"]
switch_mode = 2
advance_mode = 2
advance_expression = "is_shooting() == false"
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_1h4ri"]
states/idle/node = SubResource("AnimationNodeAnimation_0ridr")
states/idle/position = Vector2(415, 106)
states/shoot/node = SubResource("AnimationNodeAnimation_6jrfv")
states/shoot/position = Vector2(649, 107)
transitions = ["Start", "idle", SubResource("AnimationNodeStateMachineTransition_0l7qe"), "idle", "shoot", SubResource("AnimationNodeStateMachineTransition_3wvhk"), "shoot", "idle", SubResource("AnimationNodeStateMachineTransition_hlvcn")]
[sub_resource type="AnimationNodeTimeScale" id="AnimationNodeTimeScale_0l7qe"]
[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_3wvhk"]
graph_offset = Vector2(-541.787, 73.4125)
nodes/main/node = SubResource("AnimationNodeStateMachine_1h4ri")
nodes/main/position = Vector2(-140, 160)
nodes/speed/node = SubResource("AnimationNodeTimeScale_0l7qe")
nodes/speed/position = Vector2(140, 140)
node_connections = [&"output", 0, &"speed", &"speed", 0, &"main"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_6jrfv"]
size = Vector2(26, 40)
[sub_resource type="SegmentShape2D" id="SegmentShape2D_gkdjr"]
b = Vector2(0, 0)
[node name="Peashooter" type="Node2D" groups=["Plants"]]
script = ExtResource("2_pk084")
max_hp = 30.0
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("2_4l0yo")
hframes = 10
vframes = 2
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
&"": SubResource("AnimationLibrary_0ridr")
}
[node name="AnimationTree" type="AnimationTree" parent="."]
tree_root = SubResource("AnimationNodeBlendTree_3wvhk")
advance_expression_base_node = NodePath("../Controller")
anim_player = NodePath("../AnimationPlayer")
parameters/speed/scale = 1.0
script = ExtResource("3_gkdjr")
[node name="GenericCollider" type="Area2D" parent="."]
collision_layer = 2
collision_mask = 0
monitoring = false
script = ExtResource("3_2lnl7")
metadata/_custom_type_script = "uid://be5rfbbl5xgeh"
[node name="CollisionShape2D" type="CollisionShape2D" parent="GenericCollider"]
position = Vector2(0, 6)
shape = SubResource("RectangleShape2D_6jrfv")
[node name="GenericHurtbox" type="Area2D" parent="."]
position = Vector2(17, -4)
collision_layer = 0
collision_mask = 4
monitorable = false
script = ExtResource("5_gkdjr")
lookup_layers = 1
metadata/_custom_type_script = "uid://cbudgx741oxtc"
[node name="CollisionShape2D" type="CollisionShape2D" parent="GenericHurtbox"]
shape = SubResource("SegmentShape2D_gkdjr")
script = ExtResource("6_tf8ra")
[node name="Controller" type="Node" parent="." node_paths=PackedStringArray("projectile_transform")]
script = ExtResource("8_0ridr")
projectile_transform = NodePath("../ShootMarker")
[node name="Timer" type="Timer" parent="Controller"]
wait_time = 1.5
one_shot = true
[node name="ShootMarker" type="Marker2D" parent="."]
position = Vector2(17, -4)
[node name="DeathHandler" type="Node" parent="."]
script = ExtResource("8_6jrfv")
[connection signal="killed" from="." to="DeathHandler" method="_on_killed"]
[connection signal="collision_end" from="GenericHurtbox" to="Controller" method="_on_generic_hurtbox_collision_end"]
[connection signal="collision_start" from="GenericHurtbox" to="Controller" method="_on_generic_hurtbox_collision_start"]
[connection signal="timeout" from="Controller/Timer" to="Controller" method="_on_timer_timeout"]