src/App/scenes/GameScene/components/index.js
// logic to determine who have won the round.
logic to determine who have won the round.
logic to determine who have won the round .
function onP2Played(newP2) {
      setP2(newP2);
      setTurn('');
      if (p1 !== newP2) {
         rules.forEach(rule => {
            if (rule.move === p1 && rule.kills === newP2) {
               setP1Wins(p1Wins + 1);
               updateIsOver(p1Wins + 1 === ROUNDS);
            }
            if (rule.move === newP2 && rule.kills === p1) {
               setP2Wins(p2Wins + 1);
               updateIsOver(p2Wins + 1 === ROUNDS);
            }
         });
         setRoundCounter(roundCounter + 1);
      }
      setTimeout(() => {
         resetRound();
      }, 1000);
   }
function onP2Played ( newP2 ) { setP2 ( newP2 ) ; setTurn ( '' ) ; if ( p1 !== newP2 ) { rules . forEach ( rule => { if ( rule . move === p1 && rule . kills === newP2 ) { setP1Wins ( p1Wins + 1 ) ; updateIsOver ( p1Wins + 1 === ROUNDS ) ; } if ( rule . move === newP2 && rule . kills === p1 ) { setP2Wins ( p2Wins + 1 ) ; updateIsOver ( p2Wins + 1 === ROUNDS ) ; } } ) ; setRoundCounter ( roundCounter + 1 ) ; } setTimeout ( ( ) => { resetRound ( ) ; } , 1000 ) ; }
logic to determine who have won the round.
logic to determine who have won the round .