コード例 #1
0
 public void bloodBurstA(PointF from, int damage) {
   if (getVisible()) {
     PointF c = center();
     int n = (int) Math.min(9 * Math.sqrt((double) damage / ch.ht()), 9);
     Splash.at(c, PointF.angle(from, c), 3.1415926f / 2, blood(), n);
   }
 }
コード例 #2
0
  @Override
  protected void onDrag(Touch t) {

    camera.target = null;

    if (pinching) {

      float curSpan = PointF.distance(touch.current, another.current);
      camera.zoom(
          GameMath.gate(PixelScene.minZoom, startZoom * curSpan / startSpan, PixelScene.maxZoom));

    } else {

      if (!dragging && PointF.distance(t.current, t.start) > dragThreshold) {

        dragging = true;
        lastPos.set(t.current);

      } else if (dragging) {
        camera.scroll.offset(PointF.diff(lastPos, t.current).invScale(camera.zoom));
        lastPos.set(t.current);
      }
    }
  }
コード例 #3
0
  @Override
  protected void onTouchDown(Touch t) {

    if (t != touch && another == null) {

      if (!touch.down) {
        touch = t;
        onTouchDown(t);
        return;
      }

      pinching = true;

      another = t;
      startSpan = PointF.distance(touch.current, another.current);
      startZoom = camera.zoom;

      dragging = false;
    }
  }