title: Javascript, need to change background image based on switch/variable
body: <p>I am making a computer game on Twine, which accepts html, javascript, css.</p>
  
  <p>I am trying to display images based on the state of the game.</p>
  
  <p>This code below, works correctly i shows all 3 images overlapping correctly.</p>
  
  <p>However, i want to display other images based on game state. For example if the player is at 20% health, it should display 2a.pgn instead of 2.pgn
  or if it is poisoned, it should show 3a.pgn instead of 3. </p>
  
  <p>And so on and so on, it does not make sense having to specify all possible combinations. Instead i just want to change a single layer at a time based on a variable/switch.</p>
  
  <pre><code>&lt;html&gt;
  &lt;div class="a1"&gt;&lt;/div&gt;
  &lt;style&gt;
  .a1 {
  width: 100%;
  height: 1000px;
  background-image: url(3.png),url(2.png),url(1.jpg);
  background-repeat: no-repeat;}
  &lt;/style&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Could you please help?</p>
  
  <p>Thank you very much.</p>
  
  <p>Cheers,</p>