コード例 #1
0
  @Override
  public void mouseDragged(MouseEvent e) {
    if (!down) return;
    if (lastPoint == null) lastPoint = new Vec(e.getPoint());

    double mx = (e.getPoint().getX() - lastPoint.getX());
    double my = (e.getPoint().getY() - lastPoint.getY());
    camera.pos.add(mx, my);
    lastPoint.set(e.getPoint());
    camera.proot.updateThis();
  }
コード例 #2
0
  @Override
  public void collision(Vec wayBefore, Vec wayAfter, MovingObject mo) {
    super.collision(wayBefore, wayAfter, mo);

    if (!mo.plattformHandler.isSpringUsed()) {
      if (plattform.isAbove(mo) || plattform.isBelow(mo)) {
        mo.plattformHandler.setSpringUsed(true);
        mo.getEnergy().setY(-mo.getEnergy().getY());
        wayAfter.setY(0);
      }
      if (plattform.isLeft(mo) || plattform.isRight(mo)) {
        wayAfter.setX(0);
      }
    }
  }