Package com.googlecode.jumpnevolve.math

Examples of com.googlecode.jumpnevolve.math.Vector


    engine.setTargetFrameRate(100);

    World world = new World(1000, 300, 1);
    world.setZoom(3000);

    world.add(new Ground(world, new Vector(300, 300), new Vector(800, 20)));

    engine.switchState(world);

    engine.start();
  }
View Full Code Here


public class Soldier extends EnemyTemplate implements GravityActing, Blockable {

  private static final long serialVersionUID = 5378834855856957746L;

  public Soldier(World world, Vector position) {
    super(world, ShapeFactory.createRectangle(position, new Vector(20.0f,
        20.0f)), Masses.SOLDIER);
  }
View Full Code Here

      Vector shotDirection) {
    super(world, ShapeFactory.createRectangle(position, 50, 50), Parameter.OBJECTS_CANNON_SHOTINTERVAL,
        activated);
    this.shotDirection = shotDirection.getDirection();
    this.startPosition = this.getPosition().add(
        new Vector(Math.abs(12.5f) * Math.signum(this.shotDirection.x),
            Math.abs(25.0f) * Math.signum(this.shotDirection.y)));
  }
 
View Full Code Here

  private NextShape extendedShape;
  private boolean isPlayerCrash = false, wasPlayerCrash = false;

  public InfoSign(World world, Vector position, String[] contents) {
    super(world,
        ShapeFactory.createRectangle(position, new Vector(30, 50)),
        Masses.NO_MASS);
    this.contents = contents;
  }
View Full Code Here

    g.translate(-this.extendedShape.getBoundingRect().width / 2.0f,
        -this.extendedShape.getBoundingRect().height / 2.0f);

    // Schriftposition berechnen
    float lineHeight = g.getFont().getLineHeight();
    Vector curStringPos = new Vector(SIDE_DISTANCE, LINE_DISTANCE);

    // Text zeilenweise darstellen
    for (int i = 0; i < this.contents.length; i++) {
      GraphicUtils.drawString(g, curStringPos, this.contents[i]);
      curStringPos = curStringPos.add(new Vector(0, LINE_DISTANCE
          + lineHeight));
    }

    // Allgemeine Endmitteilung darstellen
    curStringPos = curStringPos.add(new Vector(END_INDENT, LINE_DISTANCE
        + lineHeight));
    GraphicUtils.drawString(g, curStringPos, END_TEXT);
  }
View Full Code Here

      width = width + 2 * SIDE_DISTANCE;
      height = (height + LINE_DISTANCE) * (this.contents.length + 2)
          + LINE_DISTANCE;

      // Shape erstellen
      Vector dim = new Vector(width / 2.0f, height / 2.0f);
      this.extendedShape = ShapeFactory.createRectangle(Vector.ZERO, dim);
    }
  }
View Full Code Here

   */
  @Test
  public void testAbs() {
    assertThat(Vector.ZERO.abs(), is(0.0f));
    assertThat(Vector.RIGHT.abs(), is(1.0f));
    assertThat(new Vector(3, 4).abs(), is(5.0f));
    assertThat(new Vector(-1, 0).abs(), is(1.0f));
  }
View Full Code Here

   * .
   */
  @Test
  public void testAdd() {
    assertThat(Vector.ZERO.add(Vector.ZERO), is(Vector.ZERO));
    assertThat(new Vector(18, 18).add(Vector.ZERO), is(new Vector(18, 18)));
    assertThat(new Vector(7, 1).add(new Vector(-2, 15)), is(new Vector(5,
        16)));
  }
View Full Code Here

   */
  @Test
  public void testDiv() {
    assertThat(Vector.RIGHT.div(1), is(Vector.RIGHT));
    assertThat(Vector.ZERO.div(300), is(Vector.ZERO));
    assertThat(new Vector(18, -29).div(2), is(new Vector(9, -14.5f)));
    assertThat(Float.isInfinite(new Vector(20, -27).div(0).abs()), is(true));
  }
View Full Code Here

   * {@link com.googlecode.jumpnevolve.math.Vector#getDirection()}.
   */
  @Test
  public void testGetDirection() {
    assertThat(Vector.RIGHT.getDirection(), is(Vector.RIGHT));
    assertThat(new Vector(10, 0).getDirection(), is(Vector.RIGHT));
    assertThat(new Vector(-99, 0).getDirection(), is(Vector.RIGHT.mul(-1)));
    assertThat(new Vector(10, 10).getDirection(), is(new Vector(1, 1)
        .getDirection()));
    assertThat(Float.isNaN(Vector.ZERO.getDirection().x), is(true));
  }
View Full Code Here

TOP

Related Classes of com.googlecode.jumpnevolve.math.Vector

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.