diff --git a/src/multiplayer.js b/src/multiplayer.js index c5b18ec..763400b 100644 --- a/src/multiplayer.js +++ b/src/multiplayer.js @@ -18,6 +18,7 @@ module.exports = function(screen, seed, intro, mainBoardPosition) { switch (name) { case '1': { + screen.term.removeListener('key', keyHandler); screen.clear(); let cursorX = 5; let cursorY = 3; @@ -69,6 +70,7 @@ module.exports = function(screen, seed, intro, mainBoardPosition) { screen.d(cursorX + 4, errorY + 1, err.errors.map(e => e.message), { color: 'brightred' }); screen.d(5, errorY + 3, '2) Back 🔙', { color: 'amber' }); screen.render(); + screen.term.on('key', keyHandler); }); }); diff --git a/src/netrisse.js b/src/netrisse.js index 3dcf91b..7730a50 100644 --- a/src/netrisse.js +++ b/src/netrisse.js @@ -7,9 +7,6 @@ const intro = require('./intro'); // multiplayer game modes: battle (default), friendly // need to wait to start the game until all players are ready (2nd board is not null) -// need to deal with concurrency issues -- what if p1 paused the game, p2 does a hold (or move), successful on p2 screen but not p1 screen because game paused -// probably change the logic to always allow the movement if it was not the main board - const colorEnabled = true; const screen = new Screen(colorEnabled);