RoamingArea.java 438 B

12345678910111213141516171819
  1. package eu.tankernn.gameEngine.entities.ai;
  2. import java.util.Random;
  3. import org.lwjgl.util.vector.Vector2f;
  4. public class RoamingArea {
  5. private Vector2f a, b;
  6. private Random rand = new Random();
  7. public RoamingArea(Vector2f a, Vector2f b) {
  8. this.a = a;
  9. this.b = b;
  10. }
  11. public Vector2f getPointInside() {
  12. return new Vector2f(a.x + rand.nextFloat() * (b.x - a.x), a.y + rand.nextFloat() * (b.y - a.y));
  13. }
  14. }