extends KinematicBody2D

var gravity = 6000.0
var velocity = Vector2(1000,1000)

func death():
	var explossion = load("res://scenes/effects/explossion_effect.tscn").instance()
	explossion.global_position = global_position
	get_parent().call_deferred("add_child", explossion)
	queue_free()

func _physics_process(delta):
	velocity.y += gravity * delta
	move_and_collide(velocity * delta)

func _on_damage_area_body_entered(body):
	if body.has_method("apply_damage"):
		body.apply_damage(1, "damage")
	death()
	
func _ready():
	$damage_area.connect("body_entered", self, "_on_damage_area_body_entered")
