+2 votes

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.

Godot version 3.3.4
in Engine by (79 points)

1 Answer

+2 votes
Best answer

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:
https://www.youtube.com/watch?v=vDbEfmPcv-Q

by (3,768 points)
selected by

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

Thank you so much for your kind reply to my shortcoming 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.