mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-07-16 10:48:14 +07:00
Disabled path finder movement (new branch)
Disabled path finder movement on this branch Bug fixes to path finder along with distance limiter Incorporated persistent path into MapViewer/Entity
This commit is contained in:
@ -228,7 +228,7 @@ public class Entity {
|
||||
return path;
|
||||
}
|
||||
|
||||
public void updatePath(Map map) {
|
||||
public void updatePath(Map map, Vector3 target) {
|
||||
map.path(position, target, path);
|
||||
}
|
||||
|
||||
@ -410,6 +410,17 @@ public class Entity {
|
||||
int x = Direction.getOffX(angle);
|
||||
int y = Direction.getOffY(angle);
|
||||
position.add(x, y, 0);
|
||||
//if (position.epsilonEquals(target) || target.equals(Vector3.Zero)) {
|
||||
// if (path.getCount() > 0) {
|
||||
// Point2 point = path.get(0);
|
||||
// target.set(point.x, point.y, 0);
|
||||
// } else {
|
||||
// setMode("NU");
|
||||
// }
|
||||
//}
|
||||
|
||||
//position.lerp(target, 1f);
|
||||
//position.set(target);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -15,13 +15,14 @@ public class MapPather {
|
||||
}
|
||||
|
||||
public boolean path(Vector3 src, Vector3 dst, GraphPath<Point2> path) {
|
||||
if (src.dst(dst) > 25f) return false;
|
||||
return path(new Point2(src), new Point2(dst), path);
|
||||
}
|
||||
|
||||
public boolean path(Point2 src, Point2 dst, GraphPath<Point2> path) {
|
||||
path.clear();
|
||||
Map.Zone zone = map.getZone(dst.x, dst.y);
|
||||
if (zone.flags(dst.x, dst.y) != 0) return false;
|
||||
if (zone == null || zone.flags(dst.x, dst.y) != 0) return false;
|
||||
|
||||
BinaryHeap<Point2> closedSet = new BinaryHeap<>();
|
||||
BinaryHeap<Point2> openSet = new BinaryHeap<>();
|
||||
|
@ -3,8 +3,8 @@ package gdx.diablo.map;
|
||||
import com.badlogic.gdx.math.Vector3;
|
||||
|
||||
public class Point2 extends BinaryHeap.Node {
|
||||
final int x;
|
||||
final int y;
|
||||
public final int x;
|
||||
public final int y;
|
||||
final int hash;
|
||||
|
||||
Point2(int x, int y, float cost) {
|
||||
|
@ -386,10 +386,13 @@ public class GameScreen extends ScreenAdapter implements LoadingScreen.Loadable
|
||||
if (Gdx.input.isButtonPressed(Input.Buttons.LEFT)) {
|
||||
// FIXME: should block click events on UI panels, bugged right now
|
||||
//Actor hit = stage.hit(Gdx.input.getX(), Gdx.input.getY(), true);
|
||||
//if (hit == null) {
|
||||
//if (hit != null) {
|
||||
Vector3 coords = mapRenderer.getCursor();
|
||||
player.target().set(coords);
|
||||
player.updatePath(map);
|
||||
//player.target().set(coords);
|
||||
//player.updatePath(map, coords);
|
||||
//if (player.path().getCount() > 0) {
|
||||
// player.setMode("RN");
|
||||
//}
|
||||
//} else {
|
||||
// System.out.println(hit);
|
||||
//}
|
||||
|
Reference in New Issue
Block a user