title: Processing, Mirroring or Flipping an Image without affecting others
body: <p>I'm developing a mini platform game with Processing using Javascript, something like Mario.</p>
  
  <p>I'm moving my character with arrows or WASD and I'd like to know if there's an alternative to <code>scale(-1,1);</code> when mirroring the character / image. (It's looking to the right by default or when you press D, and when you press A it flips to left).</p>
  
  <p>If it's the best or easiest way, I'd also like to know <strong>how to make the scale method not to affect all the rest of images</strong>, since I want to put some platforms but with scale they keep flipping while character moves...</p>
  
  <p>I'm also listening to any info related to sprite / sound usage with Processing and Javascript. I've tried some libraries but they only work when I switch to Java mode.</p>
  
  <p>Thanks in advance,
  Maral.</p>
  
  <p>I used the scale mirroring thanks to a previous post.
  <a href="https://stackoverflow.com/questions/29334348/processing-mirror-image-over-x-axis">Processing mirror image over x axis?</a></p>
  
  <p>"dreta" is Right and "esquerre" is Left, both are controlled with WASD or Keys changing each boolean on press to true and on release to false.
  I didn't post all the code but this is the basic movement I wanted to fix.</p>
  
  <pre><code>   void draw() {
         pushMatrix();
         if (iniciar == true) {
         inici();
      }
      if (dreta == true &amp;&amp; esquerre != true) {
        movDret(backgroundimg[2]);
      }
      if (esquerre == true &amp;&amp; dreta != true) {
        movEsquerre(backgroundimg[2]);
      }
    }
  
     void platformndBackground(PImage b){
        background(b);
        popMatrix();
        image(imgGrass[0], 50, 50);
        if (esquerre == true) {
          scale(-1,1);
        }
     }
  
     void inici() {
        movDret(backgroundimg[2]);
        iniciar = false;
     }
  
     void movDret(PImage b) {
        //Colisió extrem Esquerre.
       if (posicio &gt; 1024-imgJugador[5].width) {
         posicio = posicio - imgJugador[tipusMoviment].width/2;
         movEsquerre(backgroundimg[2]);
       } else {
         bothMoviments(b);
         image(imgJugador[tipusMoviment], posicio, posicioSalt);
         posicio = posicio + 3;
       }
     }
  
      void movEsquerre(PImage b) {
        //Colisió extrem Dret.
        if (posicio &lt; 0) {
          posicio = posicio + imgJugador[tipusMoviment].width/2;
          popMatrix();
          movDret(backgroundimg[2]);
        } else {
          bothMoviments(b);
          image(imgJugador[tipusMoviment], ((-imgJugador[tipusMoviment].width)-posicio), posicioSalt);
          posicio = posicio - 3;
        }
      }
  
      void bothMoviments(PImage b) {
        if (esquerre == true) {
          scale(-1, 1);
        }else{
          popMatrix();
        }
          if (tipusMoviment &lt; imgJugador.length-1) {
            tipusMoviment++;
          } else {
            tipusMoviment = 5;
          }
          platformndBackground(b);
      }
  </code></pre>