Package com.badlogic.gdx.math

Examples of com.badlogic.gdx.math.Vector2


  private Bullet getSquiggleBullet(Ship ship , float bulletScale) {
    int amplitude = 45;
    float frequency = 5;

    return new EnemySquiggleBullet(EnemySquiggleBullet.BULLETSPEED, 0, .5f * bulletScale* Configuration.gameScale,
        .5f * bulletScale* Configuration.gameScale, new Vector2(getPosition().x + getWidth() / 2, getPosition().y
            + getHeight() / 2), new Vector2(ship.getPosition().tmp().sub(getPosition()).nor()), amplitude,
        frequency, this.variation);
  }
View Full Code Here


  }

  private Bullet getSplitBullet(Ship ship, float bulletScale, float splitAngle, float splitTime, boolean hasSplit) {

    return new EnemySplitBullet(EnemySquiggleBullet.BULLETSPEED, 0, .5f* bulletScale * Configuration.gameScale,
        .5f* bulletScale * Configuration.gameScale, new Vector2(getPosition().x + getWidth() / 2, getPosition().y
            + getHeight() / 2), new Vector2(ship.getPosition().tmp().sub(getPosition()).nor()),
        this.variation, splitAngle, splitTime, hasSplit, bulletScale);

  }
View Full Code Here

  int counter = 0;
  Level level;

  public World(TestGame game, Level level) {
    this.game = game;
    ship = new Ship(new Vector2(10 * Configuration.gameScale, 3 * Configuration.gameScale),
        .4f * Configuration.gameScale, .4f * Configuration.gameScale, 0, 4f * Configuration.gameScale, 1,
        new InfoBox());
    ship.setDamage(ship.getBaseDamage());
    this.level = level;

View Full Code Here

    items.add(item);
  }

  public void putExplosion(float x, float y, String variation) {
    Explosion explosion = new Explosion(0f, 0, 1 * Configuration.gameScale, 1 * Configuration.gameScale,
        new Vector2(x, y), 1, variation);
    explosions.add(explosion);
  }
View Full Code Here

  }

  public void putSecondaryExplosion(float x, float y, String variation) {

    Explosion explosion = new Explosion(0f, random.nextInt(9 * Configuration.gameScale),
        1.5f * Configuration.gameScale, .2f * Configuration.gameScale, new Vector2(x, y), .8f, variation);
    secondaryExplosions.add(explosion);

  }
View Full Code Here

      if (item != null) {
        if (dropCount > 1) {
          Random random = new Random();
          float angle = 20 - random.nextInt(40);

          item.setVelocity(new Vector2(new Vector2(angle * Configuration.gameScale,
              50 * Configuration.gameScale).sub(getPosition()).nor()));
        }
        world.putItem(item);
      }
    }
 
View Full Code Here

        tiletyp = _tiletyp;
    }

    @Override
    public Vector2 getPositionV2() {
        return new Vector2(posX, posY);
    }
View Full Code Here

   
    final Body boxBody = pPhysicsWorld.createBody(lineBodyDef);
   
    final PolygonShape linePoly = new PolygonShape();
   
    linePoly.setAsEdge(new Vector2(pX1 / pPixelToMeterRatio, pY1 / pPixelToMeterRatio), new Vector2(pX2 / pPixelToMeterRatio, pY2 / pPixelToMeterRatio));
    pFixtureDef.shape = linePoly;
   
    boxBody.createFixture(pFixtureDef);
   
    linePoly.dispose();
View Full Code Here

  public void onUpdate(final float pSecondsElapsed) {
    final IShape shape = this.mShape;
    final Body body = this.mBody;

    if(this.mUpdatePosition) {
      final Vector2 position = body.getPosition();
      final float pixelToMeterRatio = this.mPixelToMeterRatio;
      shape.setPosition(position.x * pixelToMeterRatio - this.mShapeHalfBaseWidth, position.y * pixelToMeterRatio - this.mShapeHalfBaseHeight);
    }

    if(this.mUpdateRotation) {
View Full Code Here

  private static boolean areVerticesClockwise(final ArrayList<Vector2> pVertices) {
    final int vertexCount = pVertices.size();

    float area = 0;
    for(int i = 0; i < vertexCount; i++) {
      final Vector2 p1 = pVertices.get(i);
      final Vector2 p2 = pVertices.get(EarClippingTriangulator.computeNextIndex(pVertices, i));
      area += p1.x * p2.y - p2.x * p1.y;
    }

    if(area < 0) {
      return true;
View Full Code Here

TOP

Related Classes of com.badlogic.gdx.math.Vector2

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.