Please, if “greedy” saves time in programming, be greedy.
A rundown:
“Can_Only_Attack_When_Stamina_Not_Depleted”
-I created a variable that tests the condition of whether stamina is depleted. By DEFAULT it is not. So, the condition (BRANCH) will come back FALSE, and the character will attack. If the STAMINA_DEPLETED comes back TRUE, then the character can not attack.
-But we have to create a condition for this to occur.
“STAMINA_DEPLETED”
-This line of code ALWAYS RUN (at least in combat mode). It constantly checks to see if the character has stamina. It’s a loop function. If the character’s stamina is set to “0” (the Stamina FLOAT), It will stop looping, by following the FALSE scenario and head to the TRUE scenario, where the EXECUTION PULSE will set STAMINA_DEPLETED to TRUE. Now the player can no longer attack. The pulse will now make its way to the STAMINA_DEPLETION_DELAY event.
“STAMINA_DELAY_EVENT”
-This is the “timer” I created that adds +1 to the Stamina FLOAT value every .1 seconds. That means, the player has to wait 10 seconds before they can attack (.1 x 100 = 10). Once Stamina FLOAT equals 100, the function will stop looping, finally taking the TRUE path, unsetting the STAMINA_DEPLETED Boolean. The player can attack again.
Further, the “STAMINA_DEPLETED” line of code will reinitiate, checking, nonstop, to see if the player has FULLY depleted their stamina. If you have a recharging system, this condition very well may never be met.
