コード例 #1
0
  // N차원 베지어 곡선 계산
  public void nextBezierN() {
    int k, kn, nn, nkn;
    double blend, muk, munk;
    int n = arrPn.length - 1;

    initResultPoint();
    muk = 1;
    munk = Math.pow(1 - mu, (double) n);
    for (k = 0; k <= n; k++) {
      nn = n;
      kn = k;
      nkn = n - k;
      blend = muk * munk;
      muk *= mu;
      munk /= (1 - mu);
      while (nn >= 1) {
        blend *= nn;
        nn--;
        if (kn > 1) {
          blend /= (double) kn;
          kn--;
        }
        if (nkn > 1) {
          blend /= (double) nkn;
          nkn--;
        }
      }
      resultPoint.x += arrPn[k].x * blend;
      resultPoint.y += arrPn[k].y * blend;
      resultPoint.z += arrPn[k].z * blend;
    }
  }
コード例 #2
0
  // 3차원 베지어 곡선 계산
  public void nextBezier3() {
    double mum1, mum12, mu2;

    initResultPoint();
    mu2 = mu * mu;
    mum1 = 1 - mu;
    mum12 = mum1 * mum1;
    resultPoint.x = p1.x * mum12 + 2 * p2.x * mum1 * mu + p3.x * mu2;
    resultPoint.y = p1.y * mum12 + 2 * p2.y * mum1 * mu + p3.y * mu2;
    resultPoint.z = p1.z * mum12 + 2 * p2.z * mum1 * mu + p3.z * mu2;
  }
コード例 #3
0
ファイル: Path.java プロジェクト: JSut210/ModDev
  /** Returns and removes the first point in the path */
  public PathPoint dequeue() {
    PathPoint var1 = this.pathPoints[0];
    this.pathPoints[0] = this.pathPoints[--this.count];
    this.pathPoints[this.count] = null;

    if (this.count > 0) {
      this.sortForward(0);
    }

    var1.index = -1;
    return var1;
  }
コード例 #4
0
  // 4차원 베지어 곡선 계산
  public void nextBezier4() {
    double mum1, mum13, mu3;

    initResultPoint();
    mum1 = 1 - mu;
    mum13 = mum1 * mum1 * mum1;
    mu3 = mu * mu * mu;
    resultPoint.x =
        mum13 * p1.x + 3 * mu * mum1 * mum1 * p2.x + 3 * mu * mu * mum1 * p3.x + mu3 * p4.x;
    resultPoint.y =
        mum13 * p1.y + 3 * mu * mum1 * mum1 * p2.y + 3 * mu * mu * mum1 * p3.y + mu3 * p4.y;
    resultPoint.z =
        mum13 * p1.z + 3 * mu * mum1 * mum1 * p2.z + 3 * mu * mu * mum1 * p3.z + mu3 * p4.z;
  }
コード例 #5
0
ファイル: Path.java プロジェクト: JSut210/ModDev
  /** Sorts a point to the left */
  private void sortBack(int par1) {
    PathPoint var2 = this.pathPoints[par1];
    int var4;

    for (float var3 = var2.distanceToTarget; par1 > 0; par1 = var4) {
      var4 = par1 - 1 >> 1;
      PathPoint var5 = this.pathPoints[var4];

      if (var3 >= var5.distanceToTarget) {
        break;
      }

      this.pathPoints[par1] = var5;
      var5.index = par1;
    }

    this.pathPoints[par1] = var2;
    var2.index = par1;
  }
コード例 #6
0
ファイル: Path.java プロジェクト: JSut210/ModDev
  /** Changes the provided point's distance to target */
  public void changeDistance(PathPoint par1PathPoint, float par2) {
    float var3 = par1PathPoint.distanceToTarget;
    par1PathPoint.distanceToTarget = par2;

    if (par2 < var3) {
      this.sortBack(par1PathPoint.index);
    } else {
      this.sortForward(par1PathPoint.index);
    }
  }
コード例 #7
0
  /** Returns a mapped point or creates and adds one */
  private final PathPoint openPoint(int par1, int par2, int par3) {
    int var4 = PathPoint.makeHash(par1, par2, par3);
    PathPoint var5 = (PathPoint) this.pointMap.lookup(var4);

    if (var5 == null) {
      var5 = new PathPoint(par1, par2, par3);
      this.pointMap.addKey(var4, var5);
    }

    return var5;
  }
コード例 #8
0
  protected PathPoint a(int i, int j, int k) {
    int l = PathPoint.a(i, j, k);
    PathPoint pathpoint = (PathPoint) this.b.get(l);

    if (pathpoint == null) {
      pathpoint = new PathPoint(i, j, k);
      this.b.a(l, pathpoint);
    }

    return pathpoint;
  }
コード例 #9
0
ファイル: Pathfinder.java プロジェクト: LinearLogic/mc-dev
  private final PathPoint a(int i, int j, int k) {
    int l = PathPoint.a(i, j, k);
    PathPoint pathpoint = (PathPoint) this.c.get(l);

    if (pathpoint == null) {
      pathpoint = new PathPoint(i, j, k);
      this.c.a(l, pathpoint);
    }

    return pathpoint;
  }
コード例 #10
0
ファイル: Path.java プロジェクト: JSut210/ModDev
  /** Adds a point to the path */
  public PathPoint addPoint(PathPoint par1PathPoint) {
    if (par1PathPoint.index >= 0) {
      throw new IllegalStateException("OW KNOWS!");
    } else {
      if (this.count == this.pathPoints.length) {
        PathPoint[] var2 = new PathPoint[this.count << 1];
        System.arraycopy(this.pathPoints, 0, var2, 0, this.count);
        this.pathPoints = var2;
      }

      this.pathPoints[this.count] = par1PathPoint;
      par1PathPoint.index = this.count;
      this.sortBack(this.count++);
      return par1PathPoint;
    }
  }
コード例 #11
0
ファイル: Path.java プロジェクト: JSut210/ModDev
  /** Sorts a point to the right */
  private void sortForward(int par1) {
    PathPoint var2 = this.pathPoints[par1];
    float var3 = var2.distanceToTarget;

    while (true) {
      int var4 = 1 + (par1 << 1);
      int var5 = var4 + 1;

      if (var4 >= this.count) {
        break;
      }

      PathPoint var6 = this.pathPoints[var4];
      float var7 = var6.distanceToTarget;
      PathPoint var8;
      float var9;

      if (var5 >= this.count) {
        var8 = null;
        var9 = Float.POSITIVE_INFINITY;
      } else {
        var8 = this.pathPoints[var5];
        var9 = var8.distanceToTarget;
      }

      if (var7 < var9) {
        if (var7 >= var3) {
          break;
        }

        this.pathPoints[par1] = var6;
        var6.index = par1;
        par1 = var4;
      } else {
        if (var9 >= var3) {
          break;
        }

        this.pathPoints[par1] = var8;
        var8.index = par1;
        par1 = var5;
      }
    }

    this.pathPoints[par1] = var2;
    var2.index = par1;
  }
コード例 #12
0
ファイル: Pathfinder.java プロジェクト: LinearLogic/mc-dev
  private int b(
      Entity entity, PathPoint pathpoint, PathPoint pathpoint1, PathPoint pathpoint2, float f) {
    int i = 0;
    byte b0 = 0;

    if (this.a(entity, pathpoint.a, pathpoint.b + 1, pathpoint.c, pathpoint1) == 1) {
      b0 = 1;
    }

    PathPoint pathpoint3 =
        this.a(entity, pathpoint.a, pathpoint.b, pathpoint.c + 1, pathpoint1, b0);
    PathPoint pathpoint4 =
        this.a(entity, pathpoint.a - 1, pathpoint.b, pathpoint.c, pathpoint1, b0);
    PathPoint pathpoint5 =
        this.a(entity, pathpoint.a + 1, pathpoint.b, pathpoint.c, pathpoint1, b0);
    PathPoint pathpoint6 =
        this.a(entity, pathpoint.a, pathpoint.b, pathpoint.c - 1, pathpoint1, b0);

    if (pathpoint3 != null && !pathpoint3.i && pathpoint3.a(pathpoint2) < f) {
      this.d[i++] = pathpoint3;
    }

    if (pathpoint4 != null && !pathpoint4.i && pathpoint4.a(pathpoint2) < f) {
      this.d[i++] = pathpoint4;
    }

    if (pathpoint5 != null && !pathpoint5.i && pathpoint5.a(pathpoint2) < f) {
      this.d[i++] = pathpoint5;
    }

    if (pathpoint6 != null && !pathpoint6.i && pathpoint6.a(pathpoint2) < f) {
      this.d[i++] = pathpoint6;
    }

    return i;
  }
コード例 #13
0
 @Override
 public PathPoint evaluate(float t, PathPoint startValue, PathPoint endValue) {
   float x, y;
   if (endValue.mOperation == PathPoint.CURVE) {
     float oneMinusT = 1 - t;
     x =
         oneMinusT * oneMinusT * oneMinusT * startValue.mX
             + 3 * oneMinusT * oneMinusT * t * endValue.mControl0X
             + 3 * oneMinusT * t * t * endValue.mControl1X
             + t * t * t * endValue.mX;
     y =
         oneMinusT * oneMinusT * oneMinusT * startValue.mY
             + 3 * oneMinusT * oneMinusT * t * endValue.mControl0Y
             + 3 * oneMinusT * t * t * endValue.mControl1Y
             + t * t * t * endValue.mY;
   } else if (endValue.mOperation == PathPoint.LINE) {
     x = startValue.mX + t * (endValue.mX - startValue.mX);
     y = startValue.mY + t * (endValue.mY - startValue.mY);
   } else {
     x = endValue.mX;
     y = endValue.mY;
   }
   return PathPoint.moveTo(x, y);
 }
コード例 #14
0
ファイル: Pathfinder.java プロジェクト: LinearLogic/mc-dev
  private PathEntity a(
      Entity entity, PathPoint pathpoint, PathPoint pathpoint1, PathPoint pathpoint2, float f) {
    pathpoint.e = 0.0F;
    pathpoint.f = pathpoint.b(pathpoint1);
    pathpoint.g = pathpoint.f;
    this.b.a();
    this.b.a(pathpoint);
    PathPoint pathpoint3 = pathpoint;

    while (!this.b.e()) {
      PathPoint pathpoint4 = this.b.c();

      if (pathpoint4.equals(pathpoint1)) {
        return this.a(pathpoint, pathpoint1);
      }

      if (pathpoint4.b(pathpoint1) < pathpoint3.b(pathpoint1)) {
        pathpoint3 = pathpoint4;
      }

      pathpoint4.i = true;
      int i = this.b(entity, pathpoint4, pathpoint2, pathpoint1, f);

      for (int j = 0; j < i; ++j) {
        PathPoint pathpoint5 = this.d[j];
        float f1 = pathpoint4.e + pathpoint4.b(pathpoint5);

        if (!pathpoint5.a() || f1 < pathpoint5.e) {
          pathpoint5.h = pathpoint4;
          pathpoint5.e = f1;
          pathpoint5.f = pathpoint5.b(pathpoint1);
          if (pathpoint5.a()) {
            this.b.a(pathpoint5, pathpoint5.e + pathpoint5.f);
          } else {
            pathpoint5.g = pathpoint5.e + pathpoint5.f;
            this.b.a(pathpoint5);
          }
        }
      }
    }

    if (pathpoint3 == pathpoint) {
      return null;
    } else {
      return this.a(pathpoint, pathpoint3);
    }
  }
コード例 #15
0
ファイル: PathFinder.java プロジェクト: devoidoflife/panoply
  /** Adds a path from start to end and returns the whole path */
  private PathEntity addToPath(
      Entity entityIn, PathPoint pathpointStart, PathPoint pathpointEnd, float maxDistance) {
    pathpointStart.totalPathDistance = 0.0F;
    pathpointStart.distanceToNext = pathpointStart.distanceToSquared(pathpointEnd);
    pathpointStart.distanceToTarget = pathpointStart.distanceToNext;
    this.path.clearPath();
    this.path.addPoint(pathpointStart);
    PathPoint pathpoint = pathpointStart;

    while (!this.path.isPathEmpty()) {
      PathPoint pathpoint1 = this.path.dequeue();

      if (pathpoint1.equals(pathpointEnd)) {
        return this.createEntityPath(pathpointStart, pathpointEnd);
      }

      if (pathpoint1.distanceToSquared(pathpointEnd) < pathpoint.distanceToSquared(pathpointEnd)) {
        pathpoint = pathpoint1;
      }

      pathpoint1.visited = true;
      int i =
          this.nodeProcessor.findPathOptions(
              this.pathOptions, entityIn, pathpoint1, pathpointEnd, maxDistance);

      for (int j = 0; j < i; ++j) {
        PathPoint pathpoint2 = this.pathOptions[j];
        float f = pathpoint1.totalPathDistance + pathpoint1.distanceToSquared(pathpoint2);

        if (f < maxDistance * 2.0F
            && (!pathpoint2.isAssigned() || f < pathpoint2.totalPathDistance)) {
          pathpoint2.previous = pathpoint1;
          pathpoint2.totalPathDistance = f;
          pathpoint2.distanceToNext = pathpoint2.distanceToSquared(pathpointEnd);

          if (pathpoint2.isAssigned()) {
            this.path.changeDistance(
                pathpoint2, pathpoint2.totalPathDistance + pathpoint2.distanceToNext);
          } else {
            pathpoint2.distanceToTarget = pathpoint2.totalPathDistance + pathpoint2.distanceToNext;
            this.path.addPoint(pathpoint2);
          }
        }
      }
    }

    if (pathpoint == pathpointStart) {
      return null;
    } else {
      return this.createEntityPath(pathpointStart, pathpoint);
    }
  }
コード例 #16
0
  /**
   * populates pathOptions with available points and returns the number of options found (args:
   * unused1, currentPoint, unused2, targetPoint, maxDistance)
   */
  private int findPathOptions(
      Entity par1Entity,
      PathPoint par2PathPoint,
      PathPoint par3PathPoint,
      PathPoint par4PathPoint,
      float par5) {
    int var6 = 0;
    byte var7 = 0;

    if (this.getVerticalOffset(
            par1Entity,
            par2PathPoint.xCoord,
            par2PathPoint.yCoord + 1,
            par2PathPoint.zCoord,
            par3PathPoint)
        == 1) {
      var7 = 1;
    }

    PathPoint var8 =
        this.getSafePoint(
            par1Entity,
            par2PathPoint.xCoord,
            par2PathPoint.yCoord,
            par2PathPoint.zCoord + 1,
            par3PathPoint,
            var7);
    PathPoint var9 =
        this.getSafePoint(
            par1Entity,
            par2PathPoint.xCoord - 1,
            par2PathPoint.yCoord,
            par2PathPoint.zCoord,
            par3PathPoint,
            var7);
    PathPoint var10 =
        this.getSafePoint(
            par1Entity,
            par2PathPoint.xCoord + 1,
            par2PathPoint.yCoord,
            par2PathPoint.zCoord,
            par3PathPoint,
            var7);
    PathPoint var11 =
        this.getSafePoint(
            par1Entity,
            par2PathPoint.xCoord,
            par2PathPoint.yCoord,
            par2PathPoint.zCoord - 1,
            par3PathPoint,
            var7);

    if (var8 != null && !var8.isFirst && var8.distanceTo(par4PathPoint) < par5) {
      this.pathOptions[var6++] = var8;
    }

    if (var9 != null && !var9.isFirst && var9.distanceTo(par4PathPoint) < par5) {
      this.pathOptions[var6++] = var9;
    }

    if (var10 != null && !var10.isFirst && var10.distanceTo(par4PathPoint) < par5) {
      this.pathOptions[var6++] = var10;
    }

    if (var11 != null && !var11.isFirst && var11.distanceTo(par4PathPoint) < par5) {
      this.pathOptions[var6++] = var11;
    }

    return var6;
  }
コード例 #17
0
  /**
   * Adds a path from start to end and returns the whole path (args: unused, start, end, unused,
   * maxDistance)
   */
  private PathEntity addToPath(
      Entity par1Entity,
      PathPoint par2PathPoint,
      PathPoint par3PathPoint,
      PathPoint par4PathPoint,
      float par5) {
    par2PathPoint.totalPathDistance = 0.0F;
    par2PathPoint.distanceToNext = par2PathPoint.func_75832_b(par3PathPoint);
    par2PathPoint.distanceToTarget = par2PathPoint.distanceToNext;
    this.path.clearPath();
    this.path.addPoint(par2PathPoint);
    PathPoint var6 = par2PathPoint;

    while (!this.path.isPathEmpty()) {
      PathPoint var7 = this.path.dequeue();

      if (var7.equals(par3PathPoint)) {
        return this.createEntityPath(par2PathPoint, par3PathPoint);
      }

      if (var7.func_75832_b(par3PathPoint) < var6.func_75832_b(par3PathPoint)) {
        var6 = var7;
      }

      var7.isFirst = true;
      int var8 = this.findPathOptions(par1Entity, var7, par4PathPoint, par3PathPoint, par5);

      for (int var9 = 0; var9 < var8; ++var9) {
        PathPoint var10 = this.pathOptions[var9];
        float var11 = var7.totalPathDistance + var7.func_75832_b(var10);

        if (!var10.isAssigned() || var11 < var10.totalPathDistance) {
          var10.previous = var7;
          var10.totalPathDistance = var11;
          var10.distanceToNext = var10.func_75832_b(par3PathPoint);

          if (var10.isAssigned()) {
            this.path.changeDistance(var10, var10.totalPathDistance + var10.distanceToNext);
          } else {
            var10.distanceToTarget = var10.totalPathDistance + var10.distanceToNext;
            this.path.addPoint(var10);
          }
        }
      }
    }

    if (var6 == par2PathPoint) {
      return null;
    } else {
      return this.createEntityPath(par2PathPoint, var6);
    }
  }
コード例 #18
0
ファイル: Enemy.java プロジェクト: TuxedoFish/MyWorkspace
 public void render(ShaderHandler sh, DisplaySetup d) {
   update(d);
   animate();
   if (Math.abs(d.getPos().y) + 1.0f > pos.y && !stopped) {
     for (int i = 0; i < playerbullets.size(); i++) {
       Vector4f tempos =
           new Vector4f(
               playerbullets.get(i).getPos().x + ((25 / Display.getWidth()) / 2.0f),
               playerbullets.get(i).getPos().y - ((25 / Display.getHeight()) / 2.0f),
               0.0f,
               1.0f);
       tempos = Matrix4f.transform(d.getModelViewMatrixAsMatrix(), tempos, tempos);
       Vector2f p1 = new Vector2f((float) myrect.getX(), (float) myrect.getY());
       Vector2f p2 =
           new Vector2f((float) (myrect.getX() + myrect.getWidth()), (float) myrect.getY());
       Vector2f p3 =
           new Vector2f(
               (float) (myrect.getX() + myrect.getWidth()),
               (float) (myrect.getY() - myrect.getHeight()));
       Vector2f p4 =
           new Vector2f((float) myrect.getX(), (float) (myrect.getY() - myrect.getHeight()));
       if (Math.abs(Math.sqrt(Math.pow(p1.x - tempos.x, 2) + Math.pow(p1.y - tempos.y, 2)))
               < (float) 40.0f / Display.getWidth()
           || Math.abs(Math.sqrt(Math.pow(p2.x - tempos.x, 2) + Math.pow(p2.y - tempos.y, 2)))
               < (float) 40.0f / Display.getWidth()
           || Math.abs(Math.sqrt(Math.pow(p3.x - tempos.x, 2) + Math.pow(p3.y - tempos.y, 2)))
               < (float) 40.0f / Display.getWidth()
           || Math.abs(Math.sqrt(Math.pow(p4.x - tempos.x, 2) + Math.pow(p4.y - tempos.y, 2)))
               < (float) 40.0f / Display.getWidth()) {
         // parent.bulletexplode(i);
         stopped = true;
       }
     }
     if (started) {
       if (stage >= dist) {
         index += 1;
         stage = 0;
         if (index >= ep.getSize()) {
           if (index == ep.getSize()) {
             this.lastp = ep.getPoint(index - 1);
             this.p = new PathPoint(new Vector2f(0.0f, 0.0f), ep.getPoint(index - 1).getIndex());
             this.p.setPos(new Vector2f(lastp.getPos().x, lastp.getPos().y - 0.6f));
             dist = 30;
           } else {
             this.stopped = true;
           }
         } else {
           this.p = ep.getPoint(index);
           this.lastp = ep.getPoint(index - 1);
           dist =
               (int)
                   (Math.sqrt(
                           Math.pow(p.getPos().x - lastp.getPos().x, 2)
                               + Math.pow(p.getPos().y - lastp.getPos().y, 2))
                       * 100.0f);
         }
       } else {
         me.changePos(
             (p.getPos().x - lastp.getPos().x) / dist, (p.getPos().y - lastp.getPos().y) / dist);
         stage += 1;
       }
     } else {
       this.index = 1;
       this.p = ep.getPoint(1);
       this.lastp = ep.getPoint(0);
       dist =
           (int)
                   Math.sqrt(
                       Math.pow(p.getPos().x - lastp.getPos().x, 2)
                           + Math.pow(p.getPos().y - lastp.getPos().y, 2))
               * 10;
       started = true;
       Vector2f startpos = ep.getPoint(0).getPos();
       me.setPos(startpos.x, startpos.y + pos.y + 1.0f);
     }
     me.render(sh);
   }
   for (int i = 0; i < explosions.size(); i++) {
     explosion.changeTexture((explosions.get(i).getAge() / 5));
     explosions.get(i).age();
     explosion.changePos(
         explosions.get(i).getPos().x - epos.x, explosions.get(i).getPos().y - epos.y);
     epos = new Vector2f(explosions.get(i).getPos().x, explosions.get(i).getPos().y);
     explosion.render(sh);
     if (explosions.get(i).getAge() > 24) {
       explosions.remove(i);
       i -= 1;
     }
   }
   if (textstage >= 35) {
     textstage = 0;
   }
   textstage += 1;
   boolean changed = true;
   for (int i = 0; i < bullets.size(); i++) {
     if (changed) {
       bullet.changeTexture((textstage / 5));
       changed = false;
     }
     boolean stopped = false;
     if (!bullets.get(i).getDestroying()) {
       bullets
           .get(i)
           .setPos(
               new Vector2f(
                   (float)
                       (bullets.get(i).getPos().x - (Math.sin(bullets.get(i).getRot()) / 200.0f)),
                   (float)
                       (bullets.get(i).getPos().y
                           - (Math.cos(bullets.get(i).getRot()) / 200.0f))));
       if (bullets.get(i).getAge() > 100) {
         bullets.get(i).setDestroyingSelf(true);
         explosions.add(new EnemyBullet(bullets.get(i).getPos(), 0.0f));
         changed = true;
         bullet.changeTexture(8);
       }
     } else {
       if (bullets.get(i).getAge() < bullets.get(i).getLastAge() + 20) {
         bullet.changeTexture(8 + ((bullets.get(i).getAge() - bullets.get(i).getLastAge()) / 5));
         changed = true;
       } else {
         stopped = true;
         bullets.remove(i);
         i -= 1;
       }
     }
     if (!stopped) {
       bullets.get(i).age();
       bullet.changePos(bullets.get(i).getPos().x - bpos.x, bullets.get(i).getPos().y - bpos.y);
       bpos = new Vector2f(bullets.get(i).getPos().x, bullets.get(i).getPos().y);
       bullet.render(sh);
       if (!bullets.get(i).getDestroying()) {
         Vector4f tempos =
             new Vector4f(
                 bullets.get(i).getPos().x + ((bullet.getWidth() / Display.getWidth()) / 2.0f),
                 bullets.get(i).getPos().y - ((bullet.getHeight() / Display.getHeight()) / 2.0f),
                 0.0f,
                 1.0f);
         tempos = Matrix4f.transform(d.getModelViewMatrixAsMatrix(), tempos, tempos);
         Vector2f p1 = new Vector2f((float) player.getX(), (float) player.getY());
         Vector2f p2 =
             new Vector2f((float) (player.getX() + player.getWidth()), (float) player.getY());
         Vector2f p3 =
             new Vector2f(
                 (float) (player.getX() + player.getWidth()),
                 (float) (player.getY() - player.getHeight()));
         Vector2f p4 =
             new Vector2f((float) player.getX(), (float) (player.getY() - player.getHeight()));
         if (Math.abs(Math.sqrt(Math.pow(p1.x - tempos.x, 2) + Math.pow(p1.y - tempos.y, 2)))
                 < (float) 40.0f / Display.getWidth()
             || Math.abs(Math.sqrt(Math.pow(p2.x - tempos.x, 2) + Math.pow(p2.y - tempos.y, 2)))
                 < (float) 40.0f / Display.getWidth()
             || Math.abs(Math.sqrt(Math.pow(p3.x - tempos.x, 2) + Math.pow(p3.y - tempos.y, 2)))
                 < (float) 40.0f / Display.getWidth()
             || Math.abs(Math.sqrt(Math.pow(p4.x - tempos.x, 2) + Math.pow(p4.y - tempos.y, 2)))
                 < (float) 40.0f / Display.getWidth()) {
           bullets.get(i).setDestroyingSelf(true);
           explosions.add(new EnemyBullet(bullets.get(i).getPos(), 0.0f));
           explosions.add(
               new EnemyBullet(
                   new Vector2f(
                       (float) (bullets.get(i).getPos().x + (Math.random() * 0.2f) - 0.1f),
                       (float) (bullets.get(i).getPos().y + (Math.random() * 0.08f) - 0.04f)),
                   0.0f));
           explosions.add(
               new EnemyBullet(
                   new Vector2f(
                       (float) (bullets.get(i).getPos().x + (Math.random() * 0.2f) - 0.1f),
                       (float) (bullets.get(i).getPos().y + (Math.random() * 0.08f) - 0.04f)),
                   0.0f));
           parent.damage(5);
         }
       }
     }
   }
 }
コード例 #19
0
 public void initResultPoint() {
   resultPoint.x = 0.0;
   resultPoint.y = 0.0;
   resultPoint.z = 0.0;
 }