title: Processing / How to make selectable object, that moves where i click
body: <p>that really sucks ... i know how to make classes, objects, interfaces, loops etc . But everytime i try to make a unit or more than one, that is moving (when i select it) to the point where i click i get errors, errors and errors .... Why the hell theres nowhere a tutorial for that ? </p>
  
  <p>My new class looks so atm : </p>
  
  <pre><code>class Unit {
  
      int X;
      int Y;
      int Breite;
      int Laenge;
      int ID;
      boolean ausgewaelht = false;
  
      Unit() {
      }
  
      Unit(int x, int y, int breite, int laenge) {
      }
  
      void create(UnitContent function) {
          function.form();
      }
  
      void move(float geschwindigkeit) {
          if(isTriggerd(X,Y,Breite,Laenge) == true){
              X = X+(int)geschwindigkeit;
              if(X &gt; width) {
                  X = 0;
              }
          }
      }  
  
      void setXandY(int x , int y) {
          X = x;
          Y = y;
      } 
  
      void setBreiteandLaenge(int breite, int laenge) {
          Breite = breite;
          Laenge = laenge;
      }  
  
      void setID(int id) {
          ID = id;
      }  
  
      int getX() {
          return X;
      }
  
      int getY() {
          return Y;
      } 
  
      int getBreite() {
          return Breite;
      }
  
      int getLaenge() {
          return Laenge;
      }    
  
      int getID() {
          return ID;
      }  
  
      boolean isTriggerd(int x, int y, int breite, int laenge) {
          if(mouseX &gt; x &amp;&amp; mouseX &lt; x+breite &amp;&amp; mouseY &gt; y &amp;&amp; mouseY &lt; y+laenge ) {
              return true;
          }
         else {
              return false; 
         }
     }
  }
  </code></pre>
  
  <p>IS there something i forgot ? 
  And how do i display 10 or 50 units of them? </p>
  
  <p>sorry for my bad english :) and thx for your help</p>