Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | PizzaOnFire99125 |
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 Grass_Effect = preload(“res://Effects/GrassEffect/Broken_Attackable_Grass.tscn”)
const Grass_Pieces = preload(“res://Other/GrassPieces.tscn”)
func place_grass_pieces():
var grassPieces = Grass_Pieces.instance()
get_parent().add_child(grassPieces)
grassPieces.global_position = global_position
func create_grass_effect():
var grassEffect = Grass_Effect.instance()
get_parent().add_child(grassEffect)
grassEffect.global_position = global_position
func _on_Hurtbox_area_entered(area):
create_grass_effect()
queue_free()
<-------------------------------- I want to put the “waiting” action here.
place_grass_pieces()