Last active
November 18, 2017 14:03
-
-
Save Mikepicker/6de2c1a30f7fc1cab7a42371769a695e 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
int randInRange(int min, int max) { | |
return rand() % (max + 1 - min) + min; | |
} | |
void spawnZombie() { | |
for (int i = 0; i < ZOMBIE_COUNT; i++) { | |
if (!zombies[i].alive) { | |
zombies[i].frameX = 0; | |
zombies[i].frameY = 0; | |
zombies[i].x = randInRange(platform.x, platform.x + platform.w - zombieWidth); | |
zombies[i].dir = survivor.x - zombies[i].x > 0 ? 1 : -1; | |
zombies[i].y = 0; | |
zombies[i].alive = true; | |
zombies[i].state = "state_walk"; | |
return; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment