extends Area2D

var direction = Vector2(0,0)
var speed = 90
var resistance = 3
var damage = 1

func _process(delta):
	translate(direction * speed * delta)

func _ready():
	randomize()
	$AudioStreamPlayer2D.play()
	

func _on_Bullet_body_entered(body):
	if resistance > 1:
		if body.is_in_group("EnemyGroup"):
			body.recieveDamage(damage)
			resistance -= 1
	else:
		$Sprites/AnimationPlayer.play("destroy")

func _on_Timer_timeout():
	$Sprites/AnimationPlayer.play("destroy")
