extends Node2D

# Helper class to create particle bursts at a position
# This is called from other scripts to spawn burst effects

static func create_fruit_burst(parent: Node, pos: Vector2):
	"""Create a small sparkle burst for fruit slices"""
	var particles = GPUParticles2D.new()
	particles.texture = preload("res://assets/images/star_01.png")
	particles.position = pos
	particles.z_index = 50
	parent.add_child(particles)
	
	# Create particle process material
	var material = ParticleProcessMaterial.new()
	
	# True omnidirectional emission in 2D
	material.direction = Vector3(1, 0, 0)
	material.spread = 180.0
	material.particle_flag_disable_z = true
	
	# Set particle behavior
	material.initial_velocity_min = 100.0
	material.initial_velocity_max = 250.0
	material.angular_velocity_min = -360.0
	material.angular_velocity_max = 360.0
	material.damping_min = 50.0
	material.damping_max = 100.0
	material.scale_min = 0.5
	material.scale_max = 1.5
	material.gravity = Vector3(0, 200, 0)
	
	particles.process_material = material
	
	# Set particle lifetime and emission
	particles.lifetime = 1.0
	particles.amount = 30  # Number of particles
	particles.explosiveness = 1.0
	particles.randomness = 1.0
	particles.one_shot = true
	particles.emitting = true
	
	# Auto cleanup
	await particles.finished
	particles.queue_free()

static func create_bomb_burst(parent: Node, pos: Vector2):
	"""Create a large explosive burst for bomb detonation"""
	var particles = GPUParticles2D.new()
	particles.texture = preload("res://assets/images/star_01.png")
	particles.position = pos
	particles.z_index = 100
	parent.add_child(particles)
	
	# Create particle process material with more intense settings
	var material = ParticleProcessMaterial.new()
	
	# True omnidirectional emission in 2D
	material.direction = Vector3(1, 0, 0)
	material.spread = 180.0
	material.particle_flag_disable_z = true
	
	# Set particle behavior
	material.initial_velocity_min = 300.0  # Faster initial velocity
	material.initial_velocity_max = 500.0
	material.angular_velocity_min = -720.0
	material.angular_velocity_max = 720.0
	material.damping_min = 100.0
	material.damping_max = 200.0
	material.scale_min = 1.0
	material.scale_max = 2.5  # Larger particles
	material.color = Color.WHITE
	material.gravity = Vector3(0, 300, 0)
	
	particles.process_material = material
	
	# Set particle lifetime and emission
	particles.lifetime = 1.5
	particles.amount = 100  # More particles
	particles.explosiveness = 1.0
	particles.randomness = 1.0
	particles.one_shot = true
	particles.emitting = true
	
	# Auto cleanup
	await particles.finished
	particles.queue_free()
