How to Play Death Animation

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

Does rambo.direction contain a hyphen?

1 Like

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

Ye, forgot the hyphen…

Thanks !!

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