This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let nickname = ""; | |
let nicknameInput = document.getElementById("nickname"); | |
function setNickname() { | |
localStorage.clear() | |
nickname = nicknameInput.value; | |
localStorage.setItem("nickname", nickname); | |
} | |
if(nicknameInput){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
publishMyDeathNews(bullet, avatar) { | |
if (amIalive) { | |
deadPlayerCh.publish("dead-notif", { | |
killerBulletId: bulletThatShotMe, | |
deadPlayerId: myClientId, | |
}); | |
} | |
amIalive = false; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Explosion extends Phaser.GameObjects.Sprite { | |
constructor(scene, x, y) { | |
super(scene, x, y, "explosion"); | |
scene.add.existing(this); | |
this.play("explode"); | |
} | |
} |
NewerOlder