when the balls bounce back the all land in the same spot, so if the user wanted to find a ball they will have to move 5 balls to get to the one they want.
locked.vy = random(-30,30);
locked.vx= random(-30,30);
i added random(-5,5); to the how speed and direction they bounced out, which didnt work, well it worked but it only changed the spot they overlapped, so i added a float for the speed and direction and then added the random outside of that code:
float ranx = random(-30,30);
float rany = random(10,80);
if ( mouseX > 160 && mouseX < 240 && mouseY > 350 - Ball.radius) {
      if (locked != null && locked != clicked) {
        locked.vy = -rany;
        locked.vx = ranx;      }
      
      locked = clicked;
      locked.x = 200;
      locked.y = 350;
      locked.vx = 0;
      locked.vy = 0;
      locked.bounded = false;
    } else if (clicked == locked) {
      locked = null;
    }
  }
No comments:
Post a Comment