Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

guys i need help in godot

A topic by The Ungodly God created Feb 15, 2022 Views: 172 Replies: 2
Viewing posts 1 to 3

 how to play the death animation and then kill the enemy. please check my code and help .

func _process(delta):

if health <= 0:

$death_timer.start()

$AnimationPlayer.play("death")

func _on_death_timer_timeout(): # this is a signal timeout

queue_free()

please help

(+1)

instead of using your death_timer to trigger the queue_free()

I would just connect the “animation_finished” signal from your AnimationPlayer Node (see below)

func _process(delta):
	if health <= 0:
		$AnimationPlayer.play("death")


func _on_AnimationPlayer_animation_finished(anim_name):
	if anim_name == "death":
		queue_free()

OK I will try 

Thanks