Hello again.
So I'm making a combat system for a game I'm working on.
The combat is basically like old-school Runescape's, where the 2 participating combatants take turns hitting each other.
Except, in this game, I'm trying to make it so you can only fight one enemy at a time, no matter what. I'm trying to
make so if you're fighting a mob and you try to attack another, your action is ignored and you continue your current fight.
I'd post the code I have, but it is such a mess with all the booleans and other variables being
in other classes that I'd have to post the whole project itself.
Here's the sequence I have:
1. I try to fight an enemy. (Once I'm in their "fight radius" and press space)
2. They fight me back. (Executes their combat-style method, in this case, non-hostile)
3. I walk away and try to fight another enemy.
(I'm still in the other enemy's "chase radius" and they follow me as I try to attack another enemy)
4. I'm able to fight the other enemy, resulting in a 1 vs 2 fight.
(The second enemy executes the same non-hostile combat method to fight back)
I don't want that. This is my goal:
1. I try to fight an enemy. (Once I'm in their "fight radius" and press space)
2. They fight me back. (Executes their combat-style method, in this case, non-hostile)
3. I walk away and try to fight another enemy.
(I'm still in the other enemy's "chase radius" and they follow me as I try to attack another enemy)
4. I'm unable to start another fight because I'm already fighting a different mob.
(The second enemy just ignores as the enemy I attacked first walks up to me and continues to attack until I kill it or run away)
Is this because of static/non-static methods and values? Instances?
I tried everything but I cannot get this 1-enemy-per-fight limit to work.
I know this is a seriously complicated situation, but does anyone know any solutions?
Let me know if I have to provide more info. O-o