This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

All I want is to trigger an animation called "dead" on the player after he enters an Area2D.

So I got this code on the Area2D:

extends Area2D
func onDeadZonebodyentered(body):
if body.isingroup("player"):
body.dead()

And this code on the player:
func dead():
$AnimatedSprite.play("dead")
yield($AnimatedSprite, "animationfinished")
get
tree().change_scene("res://scenes/screens/GameOverScreen.tscn")

even though godot is waiting until the animation is finished before loading the next level the animation itself is not playing
I just don't get this one :D
All I want is to trigger an animation called "dead" on the player after he enters an Area2D.

So I got this code on the Area2D:

extends Area2D
func onDeadZonebodyentered(body):
if body.isingroup("player"):
body.dead()

And this code on the player:
func dead():
$AnimatedSprite.play("dead")
yield($AnimatedSprite, "animationfinished")
get
tree().change_scene("res://scenes/screens/GameOverScreen.tscn")

even though godot is waiting until the animation is finished before loading the next level the animation itself is not playing.
I just don't get this one :D smb. help please ...

in Engine by (27 points)

When you running game if you press remote and go to player node can you see the amimation change?

Also how does the animation look like?

Hey, thx for your questions:

  1. I can not see the animation changed, because the player character is its own scene and the animated sprite node is not the root node of it.

  2. It is a simple dead animation that should be triggered as soon as the character steps into a trap. I also trigger a reload of the scene after the animation is finished, which also works. It is just that the animation itself is not played somehow.

Yey I got it. :D the problem was that I had a default state which contained an idle animation that overwrote my dead animation. i fixed that with an boolean :D thx for all help

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.