Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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;
- }
- }
- }
Add Comment
Please, Sign In to add comment