[gd_scene load_steps=22 format=2]

[ext_resource path="res://samagri/pig/Dead.png" type="Texture" id=1]
[ext_resource path="res://samagri/pig/Hit.png" type="Texture" id=2]
[ext_resource path="res://src/actors/Enemy.gd" type="Script" id=3]
[ext_resource path="res://samagri/pig/Run.png" type="Texture" id=4]
[ext_resource path="res://samagri/sfx/pain.wav" type="AudioStream" id=5]

[sub_resource type="AtlasTexture" id=1]
flags = 4
atlas = ExtResource( 2 )
region = Rect2( 0, 0, 77, 64 )

[sub_resource type="AtlasTexture" id=2]
flags = 4
atlas = ExtResource( 2 )
region = Rect2( 77, 0, 77, 64 )

[sub_resource type="AtlasTexture" id=3]
flags = 4
atlas = ExtResource( 4 )
region = Rect2( 0, 0, 77, 64 )

[sub_resource type="AtlasTexture" id=4]
flags = 4
atlas = ExtResource( 4 )
region = Rect2( 77, 0, 77, 64 )

[sub_resource type="AtlasTexture" id=5]
flags = 4
atlas = ExtResource( 4 )
region = Rect2( 154, 0, 77, 64 )

[sub_resource type="AtlasTexture" id=6]
flags = 4
atlas = ExtResource( 4 )
region = Rect2( 231, 0, 77, 64 )

[sub_resource type="AtlasTexture" id=7]
flags = 4
atlas = ExtResource( 4 )
region = Rect2( 308, 0, 77, 64 )

[sub_resource type="AtlasTexture" id=8]
flags = 4
atlas = ExtResource( 4 )
region = Rect2( 385, 0, 77, 64 )

[sub_resource type="AtlasTexture" id=9]
flags = 4
atlas = ExtResource( 1 )
region = Rect2( 0, 0, 77, 64 )

[sub_resource type="AtlasTexture" id=10]
flags = 4
atlas = ExtResource( 1 )
region = Rect2( 77, 0, 77, 64 )

[sub_resource type="AtlasTexture" id=11]
flags = 4
atlas = ExtResource( 1 )
region = Rect2( 154, 0, 77, 64 )

[sub_resource type="AtlasTexture" id=12]
flags = 4
atlas = ExtResource( 1 )
region = Rect2( 231, 0, 77, 64 )

[sub_resource type="SpriteFrames" id=13]
animations = [ {
"frames": [ SubResource( 1 ), SubResource( 2 ) ],
"loop": true,
"name": "hit",
"speed": 5.0
}, {
"frames": [ SubResource( 3 ), SubResource( 4 ), SubResource( 5 ), SubResource( 6 ), SubResource( 7 ), SubResource( 8 ) ],
"loop": true,
"name": "run",
"speed": 10.0
}, {
"frames": [ SubResource( 9 ), SubResource( 10 ), SubResource( 11 ), SubResource( 12 ) ],
"loop": false,
"name": "die",
"speed": 5.0
} ]

[sub_resource type="RectangleShape2D" id=14]
extents = Vector2( 21, 18 )

[sub_resource type="RectangleShape2D" id=15]
extents = Vector2( 22, 17 )

[sub_resource type="RectangleShape2D" id=16]
extents = Vector2( 22, 1 )

[node name="Enemy" type="KinematicBody2D"]
collision_layer = 2
collision_mask = 93
script = ExtResource( 3 )
speed = Vector2( 240, 500 )

[node name="VisibilityEnabler2D" type="VisibilityEnabler2D" parent="."]
position = Vector2( -2.14577e-06, -19 )
scale = Vector2( 2.9, 2.4 )
process_parent = true
physics_process_parent = true

[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
position = Vector2( -9, -30 )
frames = SubResource( 13 )
animation = "run"
frame = 1
playing = true

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2( 0, -18 )
shape = SubResource( 14 )

[node name="RightPlatformDetector" type="RayCast2D" parent="."]
position = Vector2( 16, 0 )
enabled = true
cast_to = Vector2( 50, 50 )
collision_mask = 8

[node name="LeftPlatformDetector" type="RayCast2D" parent="."]
position = Vector2( -16, 0 )
enabled = true
cast_to = Vector2( -50, 50 )
collision_mask = 8

[node name="Shot" type="Timer" parent="."]
wait_time = 0.5
one_shot = true

[node name="Destroy" type="Timer" parent="."]
wait_time = 2.0

[node name="LeftRightCollisionDetector" type="Area2D" parent="."]
collision_layer = 2

[node name="CollisionShape2D" type="CollisionShape2D" parent="LeftRightCollisionDetector"]
position = Vector2( 0, -18 )
shape = SubResource( 15 )

[node name="TopCollisionDetector" type="Area2D" parent="."]
collision_layer = 2

[node name="CollisionShape2D" type="CollisionShape2D" parent="TopCollisionDetector"]
position = Vector2( 0, -37 )
shape = SubResource( 16 )

[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."]
position = Vector2( 0, -7 )
stream = ExtResource( 5 )
volume_db = -10.0

[connection signal="timeout" from="Shot" to="." method="_on_Shot_timeout"]
[connection signal="timeout" from="Destroy" to="." method="_destroy"]
[connection signal="body_entered" from="LeftRightCollisionDetector" to="." method="_on_LeftRightCollisionDetector_body_entered"]
[connection signal="body_entered" from="TopCollisionDetector" to="." method="_on_TopCollisionDetector_body_entered"]
