Hey all! Thanks for taking time out to help a fellow in need.
Lets start with some background info: Im working on a platformer/RPG crossover, and as it grows, so does its complexity. Right now im trying to add multiple types of unique AI (enemies). As of now i only have 3 but i expect to have a total of 10ish. My problem today is a damage system. AS OF NOW i have 2 things that damage enemies: Thrown Weapons and Melee Weapons both wielded by the player. Now what i want to do is that on collision with a weapon, there should be a global system of subtracting health form enemies (health is stored locally by each enemy as an instance variable, and once it falls below or is equal to 0, the enemy is destroyed). For example, as of now my code is *weapon* on collision with *enemy* => Subtract X health from *enemy*. However, this code has to be repeated for each discrete enemy. Is there a way, by making an enemies family, that i can create a system in which, when the weapon collides with anything from that family, health is subtracted from the discrete enemy? Because my melee attacks consist of "streaks" so each attack has a different damage and i have to code damage separately, making ti both arduous and (i assume) inefficient.
Basically, what im trying to make is:
say, enemyFamily on collision with weapon, subtract *damage* from enemy(who actually hit the weapon).HP
Im not sure if this is clear to everyone so ill rephrase it:
If my weapon collides with enemy1 from the family "enemies" , the equivalent weapon damage should be deducted from enemy1.
Heres an image of my current event sheet for melee weapons. Basically the enemyGeneric should be generalized to mean whatever object from the "enemies" family the weapon hit.