How to Play Death Animation

#1

Hello everyone,
How do I make the character perform the death animation?

This is what I have at this moment:

imagem
imagem
imagem

But it doesnt work… the player stands still…

Thanks in advance

0 Likes

#2

Does rambo.direction contain a hyphen?

1 Like

#3

hello @Rafael_Silva,
i believe your killRambo function should be like this:

killRambo(rambo) {
	this.rambo.setVelocity(0);
	this.rambo.alive = false;
	this.rambo.anims.play('dead-'+rambo.direction, true);	
}

If the context of this killRambo function is the scene and if you have an object called rambo in your scene.

1 Like

#4

Ye, forgot the hyphen…

Thanks !!

0 Likes

#5

Glad we could help.

I guess you can even omit the this keyword since rambo is passed as the first argument in killRambo()

1 Like