Just wondering how people might handle melee attacking?
I am making a 2.5D platformer, and my character, throughout the course of the game, will be able to upgrade their weapon.
I’m thinking:
The player has a reference to a Weapon.
The Weapon is a trigger collider which is moved around in front of the player, and is enabled for a few frames when the player hits the attack button.
The Weapon’s OnTriggerEnter checks for any colliders which might be Enemies, and calls their Harm(damage) method.
That seems simple enough, but it feels a little messy to be dealing with the weapon as a (mostly) autonomous entity.
I’d love to hear suggestions from anyone who might have alternatives for dealing with melee attacks.