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

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.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 = 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:

func _ready(): = 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 ( 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.