title: Processing with tuio
body: <p>hi i am new to processing and i'm trying to figure out how to make the sphere move from left to right using a marker instead of the mouse. can you help me please? i can use the marker to shoot but i cant move the sphere by shooting</p>
  
  <pre><code>import TUIO.*;
  TuioProcessing tuioClient;
  HashMap symbols=new HashMap();
  
  PFont fontA;
  int sphereDiameter = 50;
  boolean shoot = false;
  
   float obj_size = 60;
  
  
   int randx()
   {
  return int(random(600));
   }
  
   int[] sphereXCoords = { randx(), randx(), randx(), randx(), randx() };
   int[] sphereYCoords = { 0, 0, 0, 0, 0 };
  
   void setup()
  {
  size(1000,700);
  
  tuioClient  = new TuioProcessing(this);
  }
  
  void draw()
  { 
  Vector&lt;TuioObject&gt; tuioObjectList =tuioClient.getTuioObjects();
   Collections.sort(tuioObjectList, comp);
  
    for (TuioObject tobj:tuioObjectList) {
    fill(50, 50, 100);
  
    int id = tobj.getSymbolID();
    int x = tobj.getScreenX(width);
    int y = tobj.getScreenY(height);
    rect(x, y, obj_size, obj_size);
  
    String txt="?";
    if (symbols.containsKey(id)) {// if it's one in symbols, then look it up
    txt = (String)symbols.get(id);
    } 
    fill(255);
    text(txt, x, y);
    }   
  
   int[] sphereXCoords = { randx(), randx(), randx(), randx(), randx() };
        fill(100, 0, 0);
        // draw the answer box
      //  ellipse(answerX, answerY, obj_size, obj_size);
        fill(255);
        // write the answer text
      // text(""+answer, answerX, answerY);
  
  
  
    background(1);
    fill(color(255,255,0));
    stroke(color(0,255,0));
    triangle(mouseX-8, 580, mouseX+8, 580, mouseX, 565);
    fill(color(255,0,0));
    stroke(color(255,0,0));
  
  if(shoot==true)
  {
    sphereKiller( mouseX);
    shoot = false;
    }
  
    sphereDropper();
    //gameEnder();  
   }
  
     Comparator&lt;TuioObject&gt; comp = new Comparator&lt;TuioObject&gt;() {
     // Comparator object to compare two TuioObjects on the basis of their x position
   // Returns -1 if o1 left of o2; 0 if they have same x pos; 1 if o1 right of o2
   public int compare(TuioObject o1, TuioObject o2) {
    if (o1.getX()&lt;o2.getX()) { 
      return -1;
      }  
    else if (o1.getX()&gt;o2.getX()) { 
    return 1;
    }  
      else { 
    return 0;
    }
    }
    };
  
      void mousePressed()
     {
    shoot = true;
    }
  
  
  
  
    void sphereDropper()
    {  
    stroke(255);
    fill(255);
  
     for (int i=0; i&lt;5; i++)
    {
    ellipse(sphereXCoords[i], sphereYCoords[i]++,
            sphereDiameter, sphereDiameter);
  
     }
    }
  
    void sphereKiller(int shotX)
    {
     boolean hit = false;
     for (int i = 0; i &lt; 5; i++)
      {
       if((shotX &gt;= (sphereXCoords[i]-sphereDiameter/2)) &amp;&amp; 
          (shotX &lt;= (sphereXCoords[i]+sphereDiameter/2)))
       {
        hit = true;
      line(mouseX, 565, mouseX, sphereYCoords[i]);
      ellipse(sphereXCoords[i], sphereYCoords[i],
              sphereDiameter+25, sphereDiameter+25);
      sphereXCoords[i] = randx();
      sphereYCoords[i] = 0;
    }    
    }
  
    if(hit == false)
    {
      line(mouseX, 565, mouseX, 0);
     }  
  
     }
  
       /* void gameEnder()
    {
     for (int i=0; i&lt; 5; i++)
      {
      if(sphereYCoords[i]==600)
    {
      fill(color(255,0,0));
      noLoop();
      }
     }
       }*/
  
    void addTuioObject(TuioObject tobj) {
  
  
      }
  
   // called when an object is removed from the scene
       void removeTuioObject(TuioObject tobj) {
       }
  
  /    / called when an object is moved
      void updateTuioObject (TuioObject tobj) {
  
    if(tobj.getSymbolID() == 32)
     {
      shoot = true;
     }
     }
  
     // called when a cursor is added to the scene
     void addTuioCursor(TuioCursor tcur) {
     }
  
    // called when a cursor is moved
    void updateTuioCursor (TuioCursor tcur) {
  
  
     }
  
     // called when a cursor is removed from the scene
    void removeTuioCursor(TuioCursor tcur) {
     }
  
     // called after each message bundle
     // representing the end of an image frame
     void refresh(TuioTime bundleTime) { 
  
    //redraw();
     }
  </code></pre>