mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-02-21 20:18:14 +07:00
Adjusted API slightly
Adjusted API slightly Added support for auto path on exit warp
This commit is contained in:
parent
f40646fb5a
commit
f76534a051
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user