extends Spatial


var power = 45

var growthrate = 0.02
var finalsize = 2.2

var explosionsound = preload("res://sounds/SFX/explosion.wav")


func _ready():
	scale = Vector3(0.2,0.2,0.2)
	$SFX.pitch_scale = rand_range(0.8,1.2)
	$SFX.stream = explosionsound
	$SFX.play()
	
	
func _process(delta):
	scale.x = lerp(scale.x, finalsize, growthrate)
	scale.y = lerp(scale.y, finalsize, growthrate)
	scale.z = lerp(scale.z, finalsize, growthrate)


func _on_Area_body_entered(body):
	if body != null:
		if body.has_method("take_damage"):
			body.take_damage(power, ext.DAMAGE_TYPES.FIRE)


func _on_Timer_timeout():
	queue_free()
