#Can someone help me to make my player react to damage in a general point

5 messages · Page 1 of 1 (latest)

fringe crypt
#

In my game, the player recives dqmage of each type of enemy indiviudaly and I would like to imporove my code

tawdry path
#

Can you post your code? Or a link to it?

fringe crypt
#

The first two are the script form the enemies and the other two, is the player reacting to them

keen lynx
#

A good way to generalize this is to make a Hitbox script and a Hurtbox script that both extend Area2D. When a hurtbox collides with a hitbox, the hitbox emits a custom signal received_damage() so other scripts can do things when they listen to it

#

Then you give each enemy a Hurtbox and your player a Hitbox