I am making a platformer, it currently looks like this:
The pink rabbit is the player, the cyan-outlined thing at the right is an enemy.
The first problem is that I want to prevent the player from attacking enemies that are in unreachable places without having to delete the colision box from the slash attack objects. This doesn't represent much of a problem right now since the only attacks in the game are the normal slashes and I could just make walls wider, but later I will add attacks with a much larger area of effect that could be easily abused to attack enemies through walls.
The second problem is more of an utility one.
This is my current script on making the enemy suffer damage:
The first slash deals 4 damage, the second one deals 5 damage and the third one deals 7 damage.
When a StaticDemon collides with any of them, they release particles, change their animation to "Hurt" and their counter to 0 (The counter adds 1 every time their Idle animation finishes and it resets on 3, the moment they shoot, so hitting them re-resets their counter).
However, this means that I wouldn't only have to "copy/paste/replace object" these attacks for every single enemy, but also for every single attack object.
The ideal solution would be finding a way to say "Slash 1, if in contact with any enemy, decreases their HP variable by 4, spawns Particles on the scene and shakes the screen by 5 for 0.1 seconds. Slash 2, if in contact with an enemy (...)" to make every attack different from each other but affecting all enemies in the same way depending on the kind of attack.