Skip to content

Instantly share code, notes, and snippets.

@Srushtika
Created June 9, 2020 14:38
Show Gist options
  • Save Srushtika/fb63addd7b2b64ff26a2b114164c7264 to your computer and use it in GitHub Desktop.
Save Srushtika/fb63addd7b2b64ff26a2b114164c7264 to your computer and use it in GitHub Desktop.
Code snippet 12 - For multiplayer space invaders article
deadPlayerCh.subscribe("dead-notif", (msg) => {
players[msg.data.deadPlayerId].isAlive = false;
killerBulletId = msg.data.killerBulletId;
alivePlayers--;
if (alivePlayers == 0) {
setTimeout(() => {
finishGame("");
}, 1000);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment