Created
November 20, 2017 14:07
-
-
Save Mikepicker/916d5b5cfb3374393287cf7caeb4b7c6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// If survivor is alive.. | |
if (survivor.state != "state_dead") { | |
... | |
// If survivor is stabbing.. | |
if (survivor.state == "state_stab") { | |
// If we're at the third animation frame, and attack has not been delivered yet.. | |
if (survivor.frameX / survivor.animSpeed == 2 && !survivor.stab) { | |
survivor.stab = true; | |
stabZombies(); // Call the utility function | |
} | |
// If the animation is complete.. | |
if (survivor.animCompleted) { | |
survivor.frameY = 0; | |
survivor.state = "state_idle"; // Go back to the idle state | |
} | |
} | |
} else { // state dead | |
if (survivor.animCompleted) { // Wait for death animation to complete | |
survivor.alive = false; // Survivor is no more | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment