extends Sprite


var spread = 1
var speed = 7

var variance = 0

enum {
	UP,
	DOWN,
	LEFT,
	RIGHT
}

var dir = LEFT


func _ready():
	randomize()
	variance = rand_range(-spread, spread)
	rotation = rotation - deg2rad(variance*2)


func _process(delta):
	delta *= 60
	if dir == LEFT:
		position.x -= speed
		position.y += variance


func _on_LifeTimer_timeout():
	queue_free()


func _on_Area2D_body_entered(body):
	if body.is_in_group("player"):
		stats.take_damage(5)
	queue_free()
