Potato mine

This commit is contained in:
Фёдор Веселов 2024-09-25 01:24:13 +05:00
commit c428bf219d
6 changed files with 245 additions and 0 deletions

View file

@ -0,0 +1,12 @@
[gd_scene load_steps=2 format=3 uid="uid://b1hjjbdwf1rtc"]
[ext_resource type="Script" path="res://scripts/components/plants/RuntimePlantData.cs" id="1_324sd"]
[node name="PlantTemplate" type="Node2D"]
script = ExtResource("1_324sd")
[node name="Sprite2D" type="Sprite2D" parent="."]
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
[node name="Hitbox" type="Area2D" parent="."]

View file

@ -0,0 +1,163 @@
[gd_scene load_steps=14 format=3 uid="uid://b5x35v3w2u8dx"]
[ext_resource type="PackedScene" uid="uid://b1hjjbdwf1rtc" path="res://scenes/entities/plants/plant_template.tscn" id="1_dj7ul"]
[ext_resource type="Texture2D" uid="uid://c77o6ba0mw7a3" path="res://assets/sprites/atlases/plants/potato_mine.png" id="2_sneas"]
[ext_resource type="Script" path="res://scripts/components/plants/ExplosionComponent.cs" id="3_2hd5y"]
[ext_resource type="Script" path="res://scripts/components/plants/behaviours/PotatomineBehaviour.cs" id="4_twx65"]
[sub_resource type="Animation" id="Animation_lpsw3"]
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": [1]
}
[sub_resource type="Animation" id="Animation_n8bxp"]
resource_name = "idle_primed"
length = 2.00001
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.333333, 0.666667, 1, 1.33333, 1.66667),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [0, 3, 6, 9, 12, 15]
}
[sub_resource type="Animation" id="Animation_vmabh"]
resource_name = "idle_unprimed"
length = 4.00001
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, 3.75, 3.91667),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [1, 7, 1]
}
[sub_resource type="Animation" id="Animation_ekg7n"]
resource_name = "prime"
length = 0.583342
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),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [2, 5, 8, 11, 14, 17, 20]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_4kofx"]
_data = {
"RESET": SubResource("Animation_lpsw3"),
"idle_primed": SubResource("Animation_n8bxp"),
"idle_unprimed": SubResource("Animation_vmabh"),
"prime": SubResource("Animation_ekg7n")
}
[sub_resource type="RectangleShape2D" id="RectangleShape2D_qfqko"]
size = Vector2(15, 27)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ti2g4"]
size = Vector2(34, 19)
[sub_resource type="CircleShape2D" id="CircleShape2D_v0g5b"]
radius = 19.0263
[sub_resource type="CircleShape2D" id="CircleShape2D_wvns6"]
radius = 19.0263
[node name="Potato mine" instance=ExtResource("1_dj7ul")]
_maxHP = 100
[node name="Sprite2D" parent="." index="0"]
texture = ExtResource("2_sneas")
hframes = 3
vframes = 7
frame = 1
[node name="AnimationPlayer" parent="." index="1"]
libraries = {
"": SubResource("AnimationLibrary_4kofx")
}
autoplay = "idle_unprimed"
[node name="Hitbox" parent="." index="2"]
collision_layer = 2
collision_mask = 0
[node name="Unprimed" type="CollisionShape2D" parent="Hitbox" index="0"]
position = Vector2(-0.5, 14.5)
shape = SubResource("RectangleShape2D_qfqko")
[node name="Primed" type="CollisionShape2D" parent="Hitbox" index="1"]
position = Vector2(0, 16.5)
shape = SubResource("RectangleShape2D_ti2g4")
disabled = true
[node name="Detectionbox" type="Area2D" parent="." index="3"]
collision_layer = 0
collision_mask = 4
[node name="CollisionShape2D" type="CollisionShape2D" parent="Detectionbox" index="0"]
position = Vector2(0, 9)
shape = SubResource("CircleShape2D_v0g5b")
[node name="ExplosionBox" type="Area2D" parent="." index="4"]
collision_layer = 0
collision_mask = 4
[node name="CollisionShape2D" type="CollisionShape2D" parent="ExplosionBox" index="0"]
position = Vector2(0, 9)
shape = SubResource("CircleShape2D_wvns6")
[node name="PrimeTimer" type="Timer" parent="." index="5"]
wait_time = 15.0
one_shot = true
autostart = true
[node name="Explosion" type="Node" parent="." index="6" node_paths=PackedStringArray("explosionArea")]
script = ExtResource("3_2hd5y")
damage = 60
explosionArea = NodePath("../ExplosionBox")
[node name="Behaviour" type="Node" parent="." index="7" node_paths=PackedStringArray("_player", "_hitbox", "_unprimedShape", "_primedShape")]
script = ExtResource("4_twx65")
_player = NodePath("../AnimationPlayer")
_hitbox = NodePath("../Hitbox")
_unprimedShape = NodePath("../Hitbox/Unprimed")
_primedShape = NodePath("../Hitbox/Primed")
[node name="ExplosionTimer" type="Timer" parent="Behaviour" index="0"]
wait_time = 0.333
one_shot = true
[connection signal="area_entered" from="Detectionbox" to="Behaviour" method="OnAreaEntered"]
[connection signal="timeout" from="PrimeTimer" to="Behaviour" method="Prime"]
[connection signal="timeout" from="Behaviour/ExplosionTimer" to="Explosion" method="Explode"]