Example #1
0
 public void mouseTouched(Actor actor, GGMouse mouse, Point spot) {
   switch (mouse.getEvent()) {
     case GGMouse.lPress:
       startLocation = toLocation(mouse.getX(), mouse.getY());
       actor.setOnTop();
       hotSpot = spot;
       break;
     case GGMouse.lDrag:
       Point imageCenter = new Point(mouse.getX() - hotSpot.x, mouse.getY() - hotSpot.y);
       actor.setPixelLocation(imageCenter);
       refresh();
       break;
     case GGMouse.lRelease:
       if (spot.x == -1) // Cursor is outside image
       actor.setLocation(startLocation);
       else {
         actor.setPixelLocation(new Point(mouse.getX(), mouse.getY()));
         nbMoves++;
         if (isOver()) setStatusText("Total #: " + nbMoves + ". Done.");
         else setStatusText("#: " + nbMoves);
       }
       actor.setLocationOffset(new Point(0, 0));
       hotSpot = null;
       refresh();
       break;
   }
 }
Example #2
0
 public void mouseTouched(Actor actor, GGMouse mouse, Point pix) {
   if (!isMouseEnabled) return;
   if (nbTaken == 3) setStatusText("Take a maximum of 3. Click 'OK' to continue");
   else {
     agent.sendCommand(agentName, Command.REPORT_POSITION, actor.getLocation().x);
     actor.removeSelf();
     nbMatches--;
     setStatusText(nbMatches + " matches remaining. Click 'OK' to continue");
     nbTaken++;
     refresh();
   }
 }