How to create heart break effects with particles 2D?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By cookieoil

My intend is to make glass shadow effects for the player hearts (health) whenever they go from full to empty, which are exactly like this video https://www.youtube.com/watch?v=JU2jaVewfxY&t=46s

I have no problem recreating the particles2D, but as a beginner, I have no ideas how to apply it into code. Sorry about the vague, maybe the codes could summary my ideas better:

healthUI node:

extends Control

var hearts = 5 setget set_hearts
var max_hearts = 5 setget set_max_hearts

onready var heartUIfull = $HeartUifull
onready var heartUIempty = $HeartUIempty

func set_hearts(value):
 hearts = clamp(value, 0, max_hearts)
 if heartUIfull != null:
	heartUIfull.rect_size.x = hearts * 25

func set_max_hearts(value):
 max_hearts = max(value, 1)
 self.hearts = min(hearts, max_hearts)
 if heartUIempty != null:
	heartUIempty.rect_size.x = hearts * 25

func _ready():
 self.max_hearts = PlayerStart.max_health
 self.hearts = PlayerStart.health
 PlayerStart.connect("health_changed", self, "set_hearts")
 PlayerStart.connect("max_health_changed", self, "set_max_hearts")

the healthUI node is also has child are shardBig and shardSmall like the video ahead and connecting with the PlayerStart (PlayerStats but I spelled it wrong), which is an autoload:

extends Node2D

export(int) var max_health = 20 setget set_max_health
var health = max_health setget set_health

signal no_health
signal health_changed(value)
signal max_health_changed(value)

func set_max_health(value):
 max_health = value
 self.health = min(health, max_health)
 emit_signal("max_health_changed", max_health)

func set_health(value):
 health = value
 emit_signal("health_changed", health)
 if health <= 0:
	emit_signal("no_health")

func _ready():
self.health = max_health

You guys probably familiar with this, in case you don’t, those are the exact same codes in HeartBeast, Player Hearts UI video (https://www.youtube.com/watch?v=7A4EPIr-6Sc&list=PL9FzW-m48fn2SlrW0KoLT4n5egNdX-W9a&index=18) which works just great, but like I said, I have no ideas how to make the particles emmiting and show up at the right position whenever the hearts turn from full to empty, it would be great if anybody have any ideas, thanks for the help and sorry for my bad English.