Skip to content

Commit

Permalink
🐛 remove menu key handler when getting input
Browse files Browse the repository at this point in the history
  • Loading branch information
ctcpip committed Jun 7, 2024
1 parent 2d45b1a commit d05c27a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/multiplayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
});
});

Expand Down
3 changes: 0 additions & 3 deletions src/netrisse.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit d05c27a

Please sign in to comment.