This file contains hidden or 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
| [ | |
| { | |
| "id": "0001ETGYTW00GW0X476W5TVBFE", | |
| "clientId": "id-q2li38voycq", | |
| "platform": "ios", | |
| "formFactor": "phone", | |
| "metadata": {}, | |
| "deviceSecret": "4hcCuDNGW349NHokMgZcxo4zud1ASy8pnA1ETs3fsCE=", | |
| "push": { | |
| "recipient": { |
This file contains hidden or 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
| [ | |
| { | |
| "deviceId": "0001ETGYTW00GW0X476W5TVBFE", | |
| "channel": "push:gmtest" | |
| } | |
| ] |
This file contains hidden or 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 hidden or 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
| const config = { | |
| width: 1400, | |
| height: 750, | |
| backgroundColor: "#FFFFF", | |
| parent: "gameContainer", | |
| scene: [GameScene], | |
| physics: { | |
| default: "arcade" | |
| } | |
| }; |
This file contains hidden or 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 GameScene extends Phaser.Scene { | |
| constructor() { | |
| super("gameScene"); | |
| } | |
| //load assets | |
| preload(){ | |
| } | |
| //init variables, define animations & sounds, and display assets |
This file contains hidden or 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
| preload() { | |
| this.load.spritesheet( | |
| "avatarA", | |
| "https://cdn.glitch.com/f66772e3-bbf6-4f6d-b5d5-94559e3c1c6f%2FInvaderA_00%402x.png?v=1589228669385", | |
| { | |
| frameWidth: 48, | |
| frameHeight: 32 | |
| } | |
| ); | |
| this.load.spritesheet( |
This file contains hidden or 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
| create() { | |
| this.anims.create({ | |
| key: "explode", | |
| frames: this.anims.generateFrameNumbers("explosion"), | |
| frameRate: 20, | |
| repeat: 0, | |
| hideOnComplete: true | |
| }); | |
| } |
This file contains hidden or 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 game = new Phaser.Game(config); |
This file contains hidden or 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
| const envConfig = require("dotenv").config(); | |
| const express = require("express"); | |
| const Ably = require("ably"); | |
| const p2 = require("p2"); | |
| const app = express(); | |
| const ABLY_API_KEY = process.env.ABLY_API_KEY; | |
| const CANVAS_HEIGHT = 750; | |
| const CANVAS_WIDTH = 1400; | |
| const SHIP_PLATFORM = 718; |
This file contains hidden or 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
| const realtime = Ably.Realtime({ | |
| key: ABLY_API_KEY, | |
| echoMessages: false, | |
| }); | |
| //create a uniqueId to assign to clients on auth | |
| const uniqueId = function () { | |
| return "id-" + totalPlayers + Math.random().toString(36).substr(2, 16); | |
| }; |