Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:

Srushtika Neelakantam Srushtika

:octocat:
View GitHub Profile
View filterWithHive-Lambda.js
//code from the lambda function
const request = require("request");
const axios = require("axios");
const ABLY_API_KEY = "<YOUR-ABLY-API-KEY>";
let textData = "";
let originalData;
let originalMessagePayload;
const publishMessageToAbly = async (textData, originalData, msgTimestamp) => {
@Srushtika
Srushtika / gameover.js
Created Jun 11, 2020
Code snippet 36 - For multiplayer space invaders article
View gameover.js
let winner = localStorage.getItem("winner");
let firstRunnerUp = localStorage.getItem("firstRunnerUp");
let secondRunnerUp = localStorage.getItem("secondRunnerUp");
let totalPlayers = localStorage.getItem("totalPlayers");
document.getElementById("winner-announcement").innerHTML =
winner + " won the game!";
if (firstRunnerUp) {
document.getElementById("first-runnerup").innerHTML =
@Srushtika
Srushtika / winner.js
Created Jun 11, 2020
Code snippet 35 - For multiplayer space invaders article
View winner.js
let winner = localStorage.getItem("winner");
let firstRunnerUp = localStorage.getItem("firstRunnerUp");
let secondRunnerUp = localStorage.getItem("secondRunnerUp");
let totalPlayers = localStorage.getItem("totalPlayers");
document.getElementById("winner-announcement").innerHTML =
winner + " won the game!";
if (firstRunnerUp) {
document.getElementById("first-runnerup").innerHTML =
@Srushtika
Srushtika / nickname.js
Last active Jun 11, 2020
Code snippet 34 - For multiplayer space invaders article
View nickname.js
let nickname = "";
let nicknameInput = document.getElementById("nickname");
function setNickname() {
localStorage.clear()
nickname = nicknameInput.value;
localStorage.setItem("nickname", nickname);
}
if(nicknameInput){
@Srushtika
Srushtika / gameover.html
Created Jun 11, 2020
Code snippet 33 - For multiplayer space invaders article
View gameover.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Space Invaders</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="Multiplayer space invaders" />
<link
id="favicon"
@Srushtika
Srushtika / winner.html
Created Jun 11, 2020
Code snippet 32- For multiplayer space invaders article
View winner.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Space Invaders</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="Multiplayer space invaders" />
<link
id="favicon"
@Srushtika
Srushtika / intro.html
Created Jun 11, 2020
Code snippet 31- For multiplayer space invaders article
View intro.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Space Invaders</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="Multiplayer space invaders" />
<link
id="favicon"
@Srushtika
Srushtika / gameRoomFull.html
Created Jun 11, 2020
Code snippet 30 - For multiplayer space invaders article
View gameRoomFull.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Space Invaders</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="Multiplayer space invaders" />
<link
id="favicon"
@Srushtika
Srushtika / script.js
Created Jun 9, 2020
Code snippet 29 - For multiplayer space invaders article
View script.js
publishMyDeathNews(bullet, avatar) {
if (amIalive) {
deadPlayerCh.publish("dead-notif", {
killerBulletId: bulletThatShotMe,
deadPlayerId: myClientId,
});
}
amIalive = false;
}
@Srushtika
Srushtika / explosion.js
Created Jun 9, 2020
Code snippet 28 - For multiplayer space invaders article
View explosion.js
class Explosion extends Phaser.GameObjects.Sprite {
constructor(scene, x, y) {
super(scene, x, y, "explosion");
scene.add.existing(this);
this.play("explode");
}
}