Package org.newdawn.slick.geom

Examples of org.newdawn.slick.geom.Vector2f


    addType(PLAYER);
    name = PLAYER;
    jumpSnd = ResourceManager.getSound("jump");
    hurtSnd = ResourceManager.getSound("hurt");

    maxSpeed = new Vector2f(3, 8);

    try {
      jumpEffect = ParticleIO
          .loadConfiguredSystem("data/fuzzy/jumpEmit.xml");
      emitter = (ConfigurableEmitter) jumpEffect.getEmitter(0);
View Full Code Here


  @Override
  public void update(GameContainer container, int delta)
      throws SlickException {
    float dx = 0;
    float dy = 0;
    Vector2f vectorSpeed = calculateVector(angle, 8);
    dx += vectorSpeed.x;
    dy += vectorSpeed.y;
    x += dx;
    y += dy;
View Full Code Here

    float centerTwoX = two.x + two.width / 2;

    float centerOneY = one.y + one.height / 2;
    float centerTwoY = two.y + two.height / 2;

    start = new Vector2f(centerOneX, centerOneY);
    end = new Vector2f(centerTwoX, centerTwoY);
    float heading = calculateAngle(start.x, start.y, end.x, end.y);
    Transform t = Transform.createRotateTransform(heading, centerOneX,
        centerOneY);
    shape = shape.transform(t);
    line = new Line(centerOneX, centerOneY, centerTwoX, centerTwoY);
View Full Code Here

    shape = shape.transform(t);
    line = new Line(centerOneX, centerOneY, centerTwoX, centerTwoY);
  }

  public Vector2f getDirection() {
    Vector2f d = new Vector2f();
    d.x = end.x - start.x;
    d.y = end.y - start.y;
    return d.normalise();
  }
View Full Code Here

  @Override
  public void update(GameContainer container, int delta)
      throws SlickException {
    float dx = 0;
    float dy = 0;
    Vector2f vectorSpeed = calculateVector(angle, 8);
    dx += vectorSpeed.x;
    dy += vectorSpeed.y;
    x += dx;
    y += dy;
View Full Code Here

  public void initStatesList(GameContainer container) throws SlickException {

    World state = new World(0, container);

    Entity e = new StaticActor(100, 100, 100, 100, "data/cross.png");
    e.speed = new Vector2f(8, 8);
    e.stateManager.addAll(new IdleState(e), new MovingState(e),
        new CombatState(e));
    state.add(e);

    addState(state);
View Full Code Here

    }

    if (ray != null) {
      Entity pl = ME.world.find(Player.PLAYER);
      ray.update(e, pl);
      Vector2f point = ray.line.getEnd();
      Vector2f cur = new Vector2f(e.x, e.y);
      cur = cur.sub(point);
      cur = cur.normalise();
      e.x -= cur.x;
      e.y -= cur.y;
    }

    timer += delta;
View Full Code Here

   * Load path from resource file
   */
  private void loadPath() {
    int num = ResourceManager.getInt("pathNum");
    for (int i = 0; i < num; i++) {
      path.add(new Vector2f(ResourceManager.getFloat("x" + i),
          ResourceManager.getFloat("y" + i)));
    }
    x = path.get(0).x;
    y = path.get(0).y;
  }
View Full Code Here

    if (player != null) {
      Angel angel = (Angel) player;
      if (normalPlayerSpeed == null) {
        // store the player speed and give him half the amount to slow
        // him down
        normalPlayerSpeed = new Vector2f(angel.maxSpeed);
        slowPlayerSpeed = new Vector2f(angel.maxSpeed.x * 0.5f,
            angel.maxSpeed.y * 2.0f);
        angel.maxSpeed = slowPlayerSpeed;
        angel.speed.x = 0;
      }
    } else {
      // no more collision so restore player friction
      if (normalPlayerSpeed != null) {
        Angel angel = (Angel) this.world.find(Angel.ANGEL);
        if (angel != null) {
          angel.maxSpeed = new Vector2f(
              Globals.originalPlayerMaxSpeed);
          normalPlayerSpeed = null;
          slowPlayerSpeed = null;
        }
      }
View Full Code Here

    width = 40;
    height = 40;

    // set different speeds and such
    gravity = 0.4f;
    maxSpeed = new Vector2f(4, 8);
    Globals.originalPlayerMaxSpeed = new Vector2f(maxSpeed);
    friction = new Vector2f(0.5f, 0.5f);
    // set hitbox
    setHitBox(6, 2, 24, 38);
    defineCommands();
    // set sounds
    // bumpSnd = ResourceManager.getSound("bump");
View Full Code Here

TOP

Related Classes of org.newdawn.slick.geom.Vector2f

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.