Proper damage system in Top-down 2d

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

Hello,

When I usually make damage system, I create a hit box and a heart box (I create an Area2D and call a function in that script that owns the area via area.owner).

But the more I think about it, the more I think it’s a waste of memory (I have multiple attack animations, so I add an Area2D for each)

Alternatively, you can access the default collision of Kinematicbody2D, but my game is only using body collision to express more realistically using YSort, i.e. it does not cover the whole, but only applies to the legs.

Would it be better to just access another area through Area2D, which is the way we are doing now, call the owner and call the appropriate function? or is there a special and elegant way?

Thank you.

:bust_in_silhouette: Reply From: timothybrentwood

The wonderful genius from our community, KidsCanCode, has an excellent in depth write up about this topic that you can find here:
http://kidscancode.org/godot_recipes/animation/melee_attacks/

There is a video at the bottom that you can also follow along to.

Heartbeast also has a great video on this topic but it’s in the middle of a series to it might not be as easy to follow along with without following the series up to that point, which you can find here:

Had to upvote simply from the awesome positivity. Hats off!

DaddyMonster | 2021-11-03 21:31

Thank you so much for your kind reply to my shortcoming question!

HorseGorilla | 2021-11-04 11:38