So I have attackable grass in my Action RPG like Zelda, and I want to place a sprite of broken grass right after the breaking animation finishes. But the sprite is placed right as the animation plays. I don't know how to make the sprite wait until the animation is done. Here's the script:
extends Node2D
const GrassEffect = preload("res://Effects/GrassEffect/BrokenAttackableGrass.tscn")
const GrassPieces = preload("res://Other/GrassPieces.tscn")
func placegrasspieces():
var grassPieces = GrassPieces.instance()
getparent().addchild(grassPieces)
grassPieces.globalposition = global_position
func creategrasseffect():
var grassEffect = GrassEffect.instance()
getparent().addchild(grassEffect)
grassEffect.globalposition = global_position
func onHurtboxareaentered(area):
creategrasseffect()
queuefree()
<-------------------------------- I want to put the "waiting" action here.
placegrass_pieces()