Question about using area2d as health component

Godot Version

4.6.2

Question

So i watched some videos about composition and decided to try adapting it to make an action rpg.

And i want to know should i make my health component extend area2d? Or is there a better way? It would make it easier to manage dealing damage like a hitbox could call on body entered check if the body has a method to take damage and deal damage with it attack stat or is there a better way. i can show my current code node and scene setup once i get to use my computer.

I also heard about event buses or autoloads but no idea how to implement either

Sounds pretty good, think I’ve done something similar before. Try it out.

An “event bus” probably won’t help you, global signals are not as useful as others make them out to be. You don’t want everything to know when one enemy is hit, you want the one enemy to know when it is hit; so use signals within the scene.

1 Like