Revert Multi-room code. I don't understand it

This commit is contained in:
A Bass 2022-04-30 16:20:03 -04:00
parent e88139e383
commit 6b9c59920a

View file

@ -4,7 +4,6 @@ const gridSize = [18, 18];
const perlinScale = 3;
var express = require('express');
<<<<<<< HEAD
class Server {
constructor(){
this.games = []
@ -42,49 +41,6 @@ class Server {
}
}
class Game {
constructor(gridSize, roomName) {
this.name = roomName
this.players = [];
this.world = new World(gridSize, perlinScale);
this.gridSize = gridSize
}
addPlayer(id, name) {
var color
switch(util.randomNumber(1,4)) {
case 1:
color = "red";
break;
case 2:
color = "aquamarine";
break;
case 3:
color = "green";
break;
case 4:
color = "yellow";
break;
}
const player = new Player(id, color, name);
this.players.push(player);
console.log(player.name)
}
removePlayer(id) {
this.players = this.players.filter(obj => obj.id != id);
console.log("removed player - " + id)
}
getPlayerByID(id) {
const player = this.players.filter(obj => obj.id == id)[0]
return player
}
}
class Player {
@ -92,13 +48,6 @@ class Player {
this.id = id;
this.color = color;
}
=======
class Player {
constructor(id, color) {
this.id = id;
this.color = color;
}
>>>>>>> parent of 9f1bf7e (Good enough for now)
}
class Game {