Commit f660c13c by Alexander Bazo

Refactor

parent d01e10a6
...@@ -4,9 +4,9 @@ const cors = require("cors"); ...@@ -4,9 +4,9 @@ const cors = require("cors");
const colyseus = require("colyseus"); const colyseus = require("colyseus");
const monitor = require("@colyseus/monitor").monitor; const monitor = require("@colyseus/monitor").monitor;
const socialRoutes = require("@colyseus/social/express").default; const socialRoutes = require("@colyseus/social/express").default;
const StarGazerRoom = require("./lib/rooms/StarGazerRoom");
const port = process.env.PORT || 2567; const port = process.env.PORT || 2567;
const app = express() const app = express();
const StarGazerRoom = require("./lib/rooms/StarGazerRoom");
app.use(cors()); app.use(cors());
app.use(express.json()); app.use(express.json());
...@@ -14,16 +14,12 @@ app.use(express.json()); ...@@ -14,16 +14,12 @@ app.use(express.json());
const server = http.createServer(app); const server = http.createServer(app);
const gameServer = new colyseus.Server({ const gameServer = new colyseus.Server({
server: server, server: server,
express: app, express: app
}); });
// register your room handlers
gameServer.define("star_gazer_lab", StarGazerRoom);
// register @colyseus/social routes gameServer.define("star_gazer_lab", StarGazerRoom);
app.use("/", socialRoutes); app.use("/", socialRoutes);
// register colyseus monitor AFTER registering your room handlers
app.use("/colyseus", monitor(gameServer)); app.use("/colyseus", monitor(gameServer));
gameServer.listen(port); gameServer.listen(port);
......
...@@ -33,7 +33,6 @@ class StarGazerRoom extends colyseus.Room { ...@@ -33,7 +33,6 @@ class StarGazerRoom extends colyseus.Room {
} }
update(deltaTime) { update(deltaTime) {
console.log("in: update");
this.state.update(deltaTime); this.state.update(deltaTime);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment