Hi!
            
             
            
            
             
            
            
             
            
            
             
            
            
             
            
            
              
           
 
            
           
             I am trying to solve this problem, that seems easy at first sight but I guess it's not that easy for me.
            
            
             I want to move this image to a random location at Mouse Click. Do you have any idea about what am I doing wrong?
            
            
             This is what happens: When I click the first time, the image it changes position to a random location and everything seems fine. But then, when I click again, it moves randomly for a moment to a new position but immediately after it goes back to the previous location.
            
            
             Thanks!
            
            - PImage pic1;
 - PImage pic2;
 - PImage pic3;
 - PImage pic4;
 - PImage pic5;
 - float randLocX = random(100, 400);
 - float randLocY = random(100, 300);
 - float X = random(100, 400);
 - float Y = random(100, 300);
 - float W = random(0, 400);
 - float Z = random(0, 400);
 - Boolean bottomLeftGuyVisible = true;
 - void setup() {
 - size(700, 700);
 - frameRate(12);
 - background(255);
 - pic1 = loadImage("stick1.png");
 - pic2 = loadImage("stick2.png");
 - pic3 = loadImage("stick3.png");
 - pic4 = loadImage("stick4.png");
 - pic5 = loadImage("stick5.png");
 - }
 - void draw() {
 - background(255);
 - drawAllGuys();
 - }
 - void mousePressed() {
 - bottomLeftGuyVisible = true;
 - }
 - void mouseReleased() {
 - bottomLeftGuyVisible = false;
 - }
 - void drawAllGuys() {
 - if (bottomLeftGuyVisible == true) {
 - drawAGuy(X, Y);
 - }if (bottomLeftGuyVisible == false) {
 - drawAGuy(W, Z);
 - }
 - }
 - void drawAGuy(float myX, float myY) {
 - if (frameCount%8==0) {
 - image(pic1, myX, myY);
 - }
 - if (frameCount%8==1) {
 - image(pic2, myX, myY);
 - }
 - if (frameCount%8==2) {
 - image(pic3, myX, myY);
 - }
 - if (frameCount%8==3) {
 - image(pic2, myX, myY);
 - }
 - if (frameCount%8==4) {
 - image(pic1, myX, myY);
 - }
 - if (frameCount%8==5) {
 - image(pic4, myX, myY);
 - }
 - if (frameCount%8==6) {
 - image(pic5, myX, myY);
 - }
 - if (frameCount%8==7) {
 - image(pic4, myX, myY);
 - }
 - }
 
 
              
              1  
            
 
            