title: Boolean switch outside of lambda
body: <p>Im working on a game in JavaFX. It's almost done but I encountered problem with move detection and can't think of simple solution. There probably is, but I'm just not aware of that</p>
  
  <p>Obviously there is more code in between but i'm highlighting the problematic part.</p>
  
  <pre><code>int finalX = x;
  int finalY = y;
  boolean jumpMade = false;
  boolean moveMade = false;
  
  // Mouse Controller
  board[x][y].setOnMouseClicked(event -&gt; {
  
      if (!moveMade) {
          move(finalX, finalY, selectedMarbleX, selectedMarbleY, selectedMarbleColor);
          // Here I would want to make moveMade = true;
          // To block further possibility of moving.
      }
  }
  </code></pre>
  
  <p>Tried changing to atomic or into one-element array but that won't do the job because the "map" that user is playing on have more than one possible direction of moving (so it wont block all of them).</p>
  
  <p>And the error that appears by just placing nonchalantly moveMade = true overthere brings up "Variable in lambda expression should be final or effectively final".</p>