![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | PizzaOnFire99125 |
So I have some breakable grass in my Action RPG like Zelda, and I want to place some broken up leaves right after the breaking animation plays, but the Sprite just gets placed as the animation plays and not after. Heres the script for better reference:
extends Node2D
const Grass_Effect = preload("res://Effects/GrassEffect/Broken_Attackable_Grass.tscn")
const Grass_Pieces = preload("res://Other/GrassPieces.tscn")
func create_grass_effect():
var grassEffect = Grass_Effect.instance()
get_parent().add_child(grassEffect)
grassEffect.global_position = global_position
func create_grass_pieces():
var grassPieces = Grass_Pieces.instance()
get_parent().add_child(grassPieces)
grassPieces.global_position = global_position
func _on_Hurtbox_area_entered(area):
queue_free()
create_grass_effect()
create_grass_pieces()
And here’s the Grass_Effect’s code to:
extends AnimatedSprite
func _ready():
play("Animate")
func _on_AnimatedSprite_animation_finished():
queue_free()
Please help! I may be making a game but I’m still new to Godot, and I don’t know how I could do this.