Browse Source

Disable score display on gun game block

Kirk Trombley 3 years ago
parent
commit
83527b18b5

+ 1 - 5
client/src/components/screens/GamePanel/GuessPane/GuessPane.jsx

@@ -26,7 +26,6 @@ const GuessPane = () => {
   const [selectedPoint, setSelectedPoint] = useState(null);
   const [submitted, setSubmitted] = useState(false);
   const [mapSize, setMapSize] = useState("small");
-  const [potentialScore, setPotentialScore] = useState(null);
   const [gunGameBlock, setGunGameBlock] = useState(false);
   const unblock = useCallback(() => setGunGameBlock(false), []);
   const toggleBig = useCallback(() => setMapSize(toggleMapSize("big")), []);
@@ -51,7 +50,6 @@ const GuessPane = () => {
       roundNum
     );
     if (score < 4000) {
-      setPotentialScore(score);
       setGunGameBlock(true);
     } else {
       await handleSubmitGuess();
@@ -60,9 +58,7 @@ const GuessPane = () => {
 
   return (
     <>
-      {gunGameBlock && gameMode === GUN_GAME && (
-        <GunGame points={potentialScore} onFinish={unblock} />
-      )}
+      {gunGameBlock && gameMode === GUN_GAME && <GunGame onFinish={unblock} />}
       <div className={`${styles.pane} ${mapSizeOpts[mapSize]}`}>
         <button
           type="button"

+ 2 - 3
client/src/components/screens/GamePanel/GuessPane/GunGame.jsx

@@ -122,7 +122,7 @@ const snakeGame = () => {
   return { start, stop, onKey };
 };
 
-const GunGame = ({ points, onFinish }) => {
+const GunGame = ({ onFinish }) => {
   const ref = useRef();
   useEffect(() => {
     const { start, stop } = snakeGame();
@@ -136,8 +136,7 @@ const GunGame = ({ points, onFinish }) => {
     <div className={styles.gungame}>
       <div className={styles.gungame_panel}>
         <div className={styles.gungame_label}>
-          <div>Not good enough! That guess only got {points} points!</div>
-          <div>Finish this snake game to try again!</div>
+          <div>Not good enough! Finish this snake game to try again!</div>
         </div>
         <canvas
           className={styles.gungame_canvas}