Adjusted API slightly

Adjusted API slightly
Added support for auto path on exit warp
This commit is contained in:
Collin Smith 2019-03-15 03:09:07 -07:00
parent f40646fb5a
commit f76534a051
2 changed files with 6 additions and 6 deletions

View File

@ -88,10 +88,10 @@ public class Warp extends Entity {
System.out.println("zim zim zala bim");
Map.Zone dst = map.findZone(dstLevel);
int dstIndex = zone.getWarp(index);
Vector2 dstPos = dst.find(dstIndex);
if (dstPos == null) throw new AssertionError("Invalid dstPos: " + dstIndex);
gameScreen.player.position.set(dstPos);
gameScreen.player.setPath(map, null);
Warp dstWarp = dst.findWarp(dstIndex);
if (dstWarp == null) throw new AssertionError("Invalid dstWarp: " + dstIndex);
gameScreen.player.position().set(dstWarp.position());
gameScreen.player.setPath(map, new Vector2(dstWarp.warp.ExitWalkX, dstWarp.warp.ExitWalkY).add(dstWarp.position()));
}
@Override

View File

@ -744,12 +744,12 @@ public class Map implements Disposable {
return presets[x][y].ds1.find(id);
}
public Vector2 find(int id) {
public Warp findWarp(int id) {
for (Entity entity : entities) {
if (entity instanceof Warp) {
Warp warp = (Warp) entity;
if (warp.index == id) {
return warp.position();
return warp;
}
}
}