Applying Damage 11:00

at 11:00

I prefer the method of enemy_hit = get_collider() and sending a signal bullet_hit.emit(enemy_hit)

then

_on_bullet_hit(id):
id.take_damage(damage)

Push the work of sorting out what happens to the enemy hit instead of the bullet.

On the enemy:

func take_damage(damage):
current_health -= damage

My reasoning for this is, not all weapons and projectiles will behave the same, and using signals better supports triggering secondary actions, for instance; effects to neighboring enemies and objects.

2 Likes

Privacy & Terms