So I've been working on enemy AI and all of its annoying intricacies these past few days for a streets of rage styled coursework project, i've managed to get their pathfinding system working but wanted to change up their hitboxes.
The enemy sprites themselves are solid objects, and originally their hitboxes were the same size as them which resulted in it being a bit janky.
So instead I opted to do something else, where the enemies actual collision hitbox is very small and instead they have another bigger sprite pinned to them which is essentially the thing that the player needs to hit to be able to damage the enemy.
Now once the enemy is spawned in, these hitboxes are spawned with them and pinned to them. But the problem I'm facing is when the enemy is hit by the player, if there are multiple enemies spawned in all with the same duplicate of the hitbox pinned to them then they all get damaged which obviously isn't very helpful.
I did try flip the hitboxes, so instead the sprite created one is pinned to the middle of the enemy. But have been having some problems considering the pinned sprite is solid and i have no clue how to properly do solid filtering.
But it feels that there is a better way to make this work so i was wondering if it would be possible that when pinned to the enemies, the sprite boxes essentially act like an instance variable would, only corresponding to that particular element of the sprite. But again, i have no idea, so some help would be greatly appreciated.
Cheers!