Added Gamestart Functionality
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
const socketIO = require("socket.io");
|
||||
const GameManager = require("../GameManager");
|
||||
const Playground = require("./Classes/Playground/Playground");
|
||||
const Game = require("./Game");
|
||||
|
||||
class GameLoop{
|
||||
/** @param {socketIO.Server} io @param {GameManager} game */
|
||||
/** @param {socketIO.Server} io @param {Game} game */
|
||||
constructor(io, game) {
|
||||
this.io = io;
|
||||
this.game = game;
|
||||
@@ -11,7 +11,16 @@ class GameLoop{
|
||||
this.playground = new Playground();
|
||||
}
|
||||
|
||||
|
||||
loop(){
|
||||
this.io.to(`game-${this.game.code}`).emit("loop", {
|
||||
code: this.game.code,
|
||||
playground: this.playground
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
this.loop();
|
||||
}, 250);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = GameLoop;
|
||||
Reference in New Issue
Block a user