title: Collider (java processing)
body: <p>I'm trying to make a basic game, where by hitting an object, the player loses a life. The way I wrote the code, this happens every time the object and the player touch. I want the player to lose only one life and not all of them. Any idea how to solve that? Thank you</p>
  
  <pre><code>  void colision() {
      for ( int i = 0; i&lt;cant; i++ ) {
  
  
        if ( personaje.x &gt; o[i].x &amp;&amp; personaje.x &lt; o[i].x + o[i].tam &amp;&amp;
          personaje.y &gt; o[i].y &amp;&amp; personaje.y &lt; o[i].y + o[i].tam/2) {
  
          //if( dist(personaje.x, personaje.y, o[i].x, o[i].y ) &lt; (personaje.ph/2 + o[i].tam/2) ){
  
          personaje.restarVida();
          personaje.reiniciar();
  
        }
      }
    }
  </code></pre>