Thanks for this lesson.
Based on what I learned in this lesson, I tried this effect out on a character with multiple child sprite.
It works quite well, I hope this code can help someone refer.
const GhostEffect: PackedScene = preload("res://src/effects/GhostEffect.tscn") func spawn_ghost_effect(sprite: Sprite): var ghost := GhostEffect.instance() ghost.texture = sprite.texture ghost.transform = sprite.transform ghost.hframes = sprite.hframes ghost.frame = sprite.frame ghost.offset = sprite.offset ghost.flip_h = sprite.flip_h ghost.flip_v = sprite.flip_v ghost.global_position = sprite.global_position var main = get_tree().current_scene call_deferred("add_child", ghost) func spawn_ghost_effect_all(sprite: Sprite): spawn_ghost_effect(sprite) for child in sprite.get_children(): if child is Sprite: spawn_ghost_effect_all(child)
Thanks for sharing! Note that for performance, it may be best to use viewports instead, to render the animated character to a viewport and buffer the rendered textures over several frames.
I had an idea at first that I would use viewport, but I didn't know how to do it. Can you add it in the future? I have high hopes for it. :)