Package org.newdawn.slick.geom

Examples of org.newdawn.slick.geom.Vector2f.normalise()


    for (int i = 0; i < 5; i++) //[10..90] - 75/5
    {
      rotation[i] = (short) new Random().nextInt(360);
      direction[i] = new Random().nextBoolean();
      vector = new Vector2f(x,y);
      vector.normalise();
      vector.setTheta(new Random().nextInt(32)-170+32*i);
      x_off[i] = vector.getX();
      y_off[i] = vector.getY();
    }
  }
View Full Code Here


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

  public void render(Graphics g) {
    g.draw(line);
  }
View Full Code Here

      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

TOP
Copyright © 2018 www.massapi.com. 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.