Guest User

Untitled

a guest
Nov 20th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. int randInRange(int min, int max) {
  2. return rand() % (max + 1 - min) + min;
  3. }
  4.  
  5. void spawnZombie() {
  6. for (int i = 0; i < ZOMBIE_COUNT; i++) {
  7. if (!zombies[i].alive) {
  8. zombies[i].frameX = 0;
  9. zombies[i].frameY = 0;
  10. zombies[i].x = randInRange(platform.x, platform.x + platform.w - zombieWidth);
  11. zombies[i].dir = survivor.x - zombies[i].x > 0 ? 1 : -1;
  12. zombies[i].y = 0;
  13. zombies[i].alive = true;
  14. zombies[i].state = "state_walk";
  15. return;
  16. }
  17. }
  18. }
Add Comment
Please, Sign In to add comment