Is it possible to set up 2D ragdoll?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ColdWavE

I am still learning about GDScript and godot engine and I “played” with the ragdoll skeleton using the website guide. My project is a 2.5D game with some effect when an enemy dies: he falls down or break in many parts using skeleton parts. When he is alive it is not a ragdoll and becomes one only when killed. Is it hard to code or is there an easy way to do it?

Thank you

:bust_in_silhouette: Reply From: Aireek

This may not quite be the answer to your question, but i’ll give you an alternative solution. This is assuming you are making a 2D game that is drawn to look 3D.

You could just have an animation of the bones falling apart when he dies. I have a plant monster that looks like a very common plant in my project. When the player gets near it, it sprouts out of the ground and chases the player. When he dies he breaks apart and his pieces fall to the ground/disintegrate. I just drew all of these different animations and then set them to play when certain conditions were met.

Crappy example:
if Skeleton HP <=0
animationplayer.play(death animation)

Theres a ton of different ways to set up your sprite changes. I’ll give you some reference videos for how i made mine.

Fornclake has a great anim_switch system (in my opinion)

This zelda tutorial (the full playlist) actually taught me ALOT of things. Even if you don’t wanna make a zelda-like game, he has a lot to offer.

Heartbeast is another amazing teacher.

Thank you for your answer! It is not exactly what I mean. The model remains 2D and I don’t really want it to look like 3d when it dies. I just want his body to fall apart (intact or broken in pieces, its not important right now) falling down like its actually a ragdoll. A good example could be this:

https://www.youtube.com/watch?v=93yUC5ASdv8

but replacing the parts with actual sprites of the monster/character model witohut the need to replace it in the moment it dies AKA when its alive it is not affected by physics.

P.S. thank you also for the links, I already started watching them. I hope GDscript won’t be a mess to understand. I just need to know how the engine calls all his functions

ColdWavE | 2020-04-17 18:15