title: Drawing isometric walls
body: <p>I'm having some trouble with isometric walls.</p>
  
  <p>I'm drawing isometric floor tiles using the back to front rendering method, and it works fine. I also keep my floor tiles lined up properly in a nice grid. The code (and this seems to be pretty much standard for isometric floor drawing) is as follows:</p>
  
  <pre><code>for(int x = 0; x &lt; 6; x++){
      for(int y  = 3; y &gt;=0 ; y--){
  
          int xCo = (y+x)*(tileWidth/2);
          int yCo = (x-y)*(tileHeight/2);
          tile.draw(g, xCo, yCo);
      }            
  }
  </code></pre>
  
  <p>This makes a nice little floor:</p>
  
  <p><img src="https://i.imgur.com/IAhnLuM.png" alt="multiple floor tiles"> </p>
  
  <p>The grid is constructed from this tile:</p>
  
  <p><img src="https://i.imgur.com/ifZ77VL.jpg" alt="A single tile"></p>
  
  <p>Unfortunately, when I use the same logic for walls, it all goes right to hell.</p>
  
  <pre><code>for(int x = 0; x &lt; 6; x++){
      for(int y  = 3; y &gt;= 0 ; y--){
  
          int xCo = (y+x)*(wallWidth()/2);
          int yCo = (x-y)*(wallHeight()/2);
          walls.draw(g, xCo, yCo);    
  }
  }
  </code></pre>
  
  <p>I'm using this as my wall tile:</p>
  
  <p><img src="https://i.imgur.com/2Cb2Y0b.png" alt="Single wall tile"></p>
  
  <p>(it's a placeholder from google image search, but it should work all the same)</p>
  
  <p>This is the result I get:</p>
  
  <p><img src="https://i.imgur.com/cfTxgs7.png" alt="Multiple wall tiles"> </p>
  
  <p>The rendering order for my walls is clearly correct, nearer walls render on top of farther away walls, which is what I want, but the positioning is also painfully incorrect, and I don't know exactly how I ought to correct that short of using pixel values.</p>
  
  <p>For reference, I did do a trial using hardcoded pixel vals, because I found that from one wall's right corner to the next wall's right corner, the change was exactly (200, -100) pixels. When I made my rendering loop account for that</p>
  
  <pre><code>int xCo = (x+y)*200;
  int yCo = (y-x)*-100;
  </code></pre>
  
  <p>it worked fine, but that is not a viable solution because it doesn't allow for any versatility.</p>
  
  <p>So, looking for suggestions on how to make my isometric walls line up. What am I doing wrong?</p>
  
  <p>Thanks!</p>