Hi guys,
I want to make some kind of small RPG, in this RPG the battle happens automatically. So the player would run/walk and meet enemy, and they'd automatically fight.
My game has several state, one of them is "inBattle" state. In that state there are a few phases, like: defineAttacker, calculateHit, calculateCritical, calculateDamage, and dealDamage. The problem I'm having is in the dealDamage phase.
what I want to achive is character (player) and monster take turn attacking depending on who is attacking this turn (decided in defineAttacker). But it seems while the monster is in the process of attacking, the attacker changes to character. So the character attack before the monster even deal its attack.
I think the problem is in the attacker variable, because the value change fastly when it is monster's turn. I know that is the problem but I don't know why that problem happens, because the attacker is decided in the defineAttacker phase.
So I want to know, is there a good way to manage states (or phases), or there is a way specific for construct to manage it
here's the file in dropbox: dropbox.com/s/t6i9qf725vcvglz/EXP%20project.capx
thanks