move the legs in steps


  void move() {
  
  x = x-xspeed;
  if(x<0) {
    x=400;
    y=int(random(10,390));
    xspeed=int(random(1,10));
  }
  if((mouseX>(x-30)) && (mouseX<(x+30))) {
    if(((mouseY>y-30)) && (mouseY<(y+30))) {
    background(#ff0000);
  }
  }
  rectMode(CENTER);
  rect(x,y,30,30);
  ellipse(mouseX,mouseY,30,30);
  }
  }
  
  </script>
  <canvas width="400" height="400"></canvas>
  </div>
  </center>