[gd_scene load_steps=8 format=2]

[ext_resource path="res://enemy.tres.gd" type="Script" id=1]

[sub_resource type="GDScript" id=6]
script/source = "extends Area2D

export var damage = -1
var attacker = ''

func _on_Timer_timeout():
	queue_free()
	pass # Replace with function body.

func _on_damage_player_body_entered(area):
	area.damage( damage, attacker)
	pass # Replace with function body.
"

[sub_resource type="RectangleShape2D" id=1]

[sub_resource type="GDScript" id=7]
script/source = "extends Area2D

func _on_damage_enemy2_body_entered(body):
	get_parent().fliph = not get_parent().global_position.x > body.global_position.x
	if get_parent().is_on_floor():
		get_parent().state = 'shooting'
	pass # Replace with function body.

func _on_damage_enemy2_body_exited(body):
	get_parent().state = 'runaround'
	pass # Replace with function body.

func _ready():
	scale.x = rand_range(0.5,2.0)
"

[sub_resource type="RectangleShape2D" id=3]
extents = Vector2( 120, 10 )

[sub_resource type="RectangleShape2D" id=4]

[sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 320, 100 )

[node name="Enemy" type="KinematicBody2D" groups=["enemy"]]
collision_layer = 12
collision_mask = 0
script = ExtResource( 1 )

[node name="damage_enemy" type="Area2D" parent="."]
collision_layer = 0
collision_mask = 2147483650
monitorable = false
script = SubResource( 6 )

[node name="CollisionShape2D" type="CollisionShape2D" parent="damage_enemy"]
shape = SubResource( 1 )
disabled = true

[node name="damage_enemy2" type="Area2D" parent="."]
collision_layer = 0
collision_mask = 2147483650
monitorable = false
script = SubResource( 7 )

[node name="CollisionShape2D" type="CollisionShape2D" parent="damage_enemy2"]
shape = SubResource( 3 )

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource( 4 )

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

[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
shape = SubResource( 2 )

[connection signal="body_entered" from="damage_enemy" to="damage_enemy" method="_on_damage_player_body_entered"]
[connection signal="body_entered" from="damage_enemy2" to="damage_enemy2" method="_on_damage_player_body_entered"]
[connection signal="body_entered" from="damage_enemy2" to="damage_enemy2" method="_on_damage_enemy2_body_entered"]
[connection signal="body_exited" from="damage_enemy2" to="damage_enemy2" method="_on_damage_enemy2_body_exited"]
[connection signal="body_entered" from="Area2D" to="." method="_on_Area2D_body_entered"]
