extends Node2D

const ExplosionEffect = preload("res://Scenes/Effects/ExplosionEffect.tscn")

var velocity = Vector2.ZERO

func _process(delta):
	position += velocity * delta


func _on_VisibilityNotifier2D_viewport_exited(_viewport):
	queue_free()


func _on_Hitbox_body_entered(_body):
	# When we collide with the world
	Utils.instance_scene_on_main(ExplosionEffect, global_position)
	queue_free()


func _on_Hitbox_area_entered(_area):
	# When we collide with an enemy (a hurtbox)
	Utils.instance_scene_on_main(ExplosionEffect, global_position)
	queue_free()
