title: Problems with determining "Overlap"
body: <p>So I have been trying to find a way to determine an "overlap" in images for a java game I am writing. Now I know I could create a box to follow the trainer that encompasses it and then use a contains point to see if the trainer's box contains the point of the Car/Pokemon, but I am trying to find an alternate way around this. I tried using nested If statements, but those do not seem to work. If it is something wrong with my coding, or an error in my way of thinking, please let me know. An example of the nested ifs is below. </p>
  
  <pre><code>if (trainer.getPy() == squirtle.getPy() &amp; trainer.getPx() == squirtle.getPx()){
      if  (trainer.getPy() &gt;= squirtle.getPy() - 50)
          if  (trainer.getPy() &lt;= squirtle.getPy() + 50)
              if  (trainer.getPx() &gt;= squirtle.getPx() -50)
                  if  (trainer.getPx() &lt;= squirtle.getPx() + 50)
                      trainer.dead();
      Skully skull = new Skully (trainer.getPx(), trainer.getPy());
  }
  if (trainer.getPy() == pikachu.getPy() &amp; trainer.getPx() == pikachu.getPx()){
      if  (trainer.getPy() &gt;= pikachu.getPy() - 50)
          if  (trainer.getPy() &lt;= pikachu.getPy() + 50)
              if  (trainer.getPx() &gt;= pikachu.getPx() -50)
                  if  (trainer.getPx() &lt;= pikachu.getPx() + 50)
                      trainer.dead();
      Skully skull = new Skully (trainer.getPx(), trainer.getPy());
  }
  </code></pre>