Skip to content

Instantly share code, notes, and snippets.

@Mikepicker
Created November 20, 2017 14:36
Show Gist options
  • Save Mikepicker/d3a2d42f4e8ff6189eb028d3f7de5ccc to your computer and use it in GitHub Desktop.
Save Mikepicker/d3a2d42f4e8ff6189eb028d3f7de5ccc to your computer and use it in GitHub Desktop.
// For each alive bullet..
for (int i = 0; i < BULLET_COUNT; i++) {
if (bullets[i].alive) {
bullets[i].x += bulletSpeed * bullets[i].dir;
// Out of screen -> dead
if (bullets[i].x + bullets[i].w < 0 || bullets[i].x > SCREEN_WIDTH) {
bullets[i].alive = false;
}
// Hit zombie
hitZombies(&bullets[i]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment