title: Change the value of a variable each time another variable changes
body: <p>I am currently making a text adventure game in Java, but I have come across a problem:</p>
  
  <p>I need the value of a <code>String</code> variable to change each time the value of a particular <code>int</code> variable changes.
  I want the program to perform this task (then continue where it left off) each time the value of an <code>int</code> variable changes:</p>
  
  <pre><code>if (enemyposition == 1) {
      enemyp = "in front of you";
  }
  else if (enemyposition == 2) {
      enemyp = "behind you";
  }
  else if (enemyposition == 3) {
      enemyp = "to your left";
  }
  else if (enemyposition == 4) {
      enemyp = "to your right";
  }
  else {
      enemyp = "WOAH";
  }
  </code></pre>
  
  <p>Thanks! :D</p>