Newround event elevated to global.

master
Ben Burlingham 5 years ago
parent 63de566fb9
commit b14cdadd41
  1. 2
      README.md
  2. 1
      client/connection.js
  3. 3
      client/controls.js
  4. 2
      client/grid.js
  5. 3
      server/ricochet.js

@ -13,6 +13,4 @@ A victory state can be stored by taking a snapshot of the current stack.
Icons from [https://game-icons.net](https://game-icons.net)
## TODO
- reset robots? on server reset...avoid multiple shadows
- "start next round" button not showing on new join in win state
- Fix 6 things

@ -91,6 +91,7 @@ Connection.prototype.onReceiveMessage = function({ data }) {
case 'connected': eventName = 'G-connected'; break;
case 'countdown': eventName = 'G-countdown'; break;
case 'full': eventName = 'G-full'; break;
case 'newround': eventName = 'G-newround'; break;
case 'objective': eventName = 'G-objective'; break;
case 'players': eventName = 'G-players'; break;
case 'robots': eventName = 'G-robots'; break;

@ -11,7 +11,6 @@ const Controls = function() {
document.addEventListener('L-conn-error', this.msgConnectionError.bind(this));
document.addEventListener('L-complete', this.msgComplete.bind(this));
document.addEventListener('L-join', this.msgJoin.bind(this));
document.addEventListener('L-newround', this.msgNewRound.bind(this));
document.addEventListener('L-replay-complete', this.msgReplayComplete.bind(this));
document.addEventListener('L-skip', this.msgSkip.bind(this));
document.addEventListener('L-stack', this.msgStack.bind(this));
@ -19,6 +18,7 @@ const Controls = function() {
document.addEventListener('G-connected', this.msgConnected.bind(this));
document.addEventListener('G-countdown', this.msgCountdown.bind(this));
document.addEventListener('G-full', this.msgFull.bind(this));
document.addEventListener('G-newround', this.msgNewRound.bind(this));
document.addEventListener('G-players', this.msgPlayers.bind(this));
document.addEventListener('G-state', this.msgState.bind(this));
document.addEventListener('G-win', this.msgWin.bind(this));
@ -199,7 +199,6 @@ Controls.prototype.msgWin = function(evt) {
Controls.prototype.msgNewRound = function() {
this.winningMoveCount = Infinity;
document.getElementById('controls-win-next').style.display = 'none';
// SHOW ARROWS IN GRID
};
Controls.prototype.msgReplayComplete = function() {

@ -13,10 +13,10 @@ const Grid = function() {
this.squaresPerSide = 20;
this.squareSideLength = 0;
document.addEventListener('L-newround', this.msgNewRound.bind(this));
document.addEventListener('L-stack', this.msgStack.bind(this));
document.addEventListener('L-shadows', this.msgShadows.bind(this));
document.addEventListener('G-newround', this.msgNewRound.bind(this));
document.addEventListener('G-robots', this.msgRobots.bind(this));
document.addEventListener('G-walls', this.msgWalls.bind(this));
document.addEventListener('G-objective', this.msgObjective.bind(this));

@ -271,6 +271,7 @@ Ricochet.prototype.msgNewRound = function() {
this.winningPlayerId = null;
this.winningStack = null;
this.messenger.messageAll({ type: 'newround' });
this.messenger.messageAll({ type: 'objective', body: this.objective});
this.messenger.messageAll({ type: 'state', body: this.state});
this.messenger.messageAll({ type: 'robots', body: this.robots});
@ -298,7 +299,7 @@ Ricochet.prototype.msgSkip = function() {
Ricochet.prototype.msgSolve = function(message) {
clearTimeout(this.countdownTimer);
this.countdownTimer = setTimeout(this.onCountdownComplete.bind(this), this.countdownDuration * 1000);
this.countdownTimestamp = new Date().getTime();

Loading…
Cancel
Save