let say I want to create an enemy that deal damage to player when touch and can receive damage from player (like Hollow Knight).
Here my current solution
- Create
hitboxat the player's weapon. - Create
hurtboxat enemy's body - Create
hitboxat enemy's body - Create
hurtboxat player's body
If I use this method, every enemy will have to check 3 collision (2 Area2D and itself Character2D). Which I think it too much (I concerned about performance), enemy hitbox and hurtbox are usually the same shape anyway.
I have an idea to merge them, but isn't that anti-pattern? And I plan to have enemies that hitbox isn't the same shape as hurtbox.
Is there any better solution? I'm quite new to godot.