Example #1
0
 private void updateSweep() {
   if (currentStone == null) {
     return;
   }
   double sweep = ui.getSelectedSweep();
   if (sweep != currentStone.getSweep()) {
     currentStone.setSweep(sweep);
     game.sendAllStones(world.getStones());
   }
 }
Example #2
0
 public void throwStone() {
   double speed = ui.getSpeed();
   speed = Math.pow(speed, 1.5);
   double v = (1.0 - speed) * 2.3 + 3.0 * speed;
   Vect2d broom = new Vect2d(world.getBroomX(), world.getBroomY());
   Vect2d dir = broom.minus(CurlingConstants.STONE_START).normalized();
   Vect2d vel = dir.times(v);
   double da = 1.0;
   if (!ui.isHandRight()) {
     da = -da;
   }
   currentStone =
       new Stone(CurlingConstants.STONE_START, vel, 0, da, game.getMatchCtrl().getCurrentTeam());
   double sweep = ui.getSelectedSweep();
   currentStone.setSweep(sweep);
   logger.info("New stone: " + currentStone);
   world.addStone(currentStone);
   game.sendNewStone(currentStone);
   ui.endTurn();
 }