mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-02-21 20:18:14 +07:00
Added player entity zone detection
Added player entity zone detection Player neutral and walk animations will display the correct town version if in town
This commit is contained in:
parent
aa84393b27
commit
db627b0076
@ -87,6 +87,8 @@ public class Player extends Entity {
|
||||
boolean ignoreUpdate;
|
||||
public Stats stats;
|
||||
public Skills skills;
|
||||
public Map map;
|
||||
public Map.Zone curZone;
|
||||
public final CharacterClass charClass;
|
||||
|
||||
Array<Item> inventory = new Array<>();
|
||||
@ -149,12 +151,12 @@ public class Player extends Entity {
|
||||
|
||||
@Override
|
||||
public byte getNeutralMode() {
|
||||
return MODE_NU;
|
||||
return (curZone != null && curZone.isTown()) ? MODE_TN : MODE_NU;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte getWalkMode() {
|
||||
return MODE_WL;
|
||||
return (curZone != null && curZone.isTown()) ? MODE_TW : MODE_WL;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -327,6 +327,7 @@ public class Map implements Disposable {
|
||||
if (DEBUG_BUILD) Gdx.app.debug(TAG, "Select " + fileName);
|
||||
|
||||
Zone zone = map.addZone(level, diff, preset, select);
|
||||
zone.town = true;
|
||||
Zone prev = zone;
|
||||
|
||||
level = Riiablo.files.Levels.get(2);
|
||||
@ -658,6 +659,7 @@ public class Map implements Disposable {
|
||||
byte flags[][];
|
||||
Array<Entity> entities;
|
||||
IntIntMap warps;
|
||||
boolean town;
|
||||
|
||||
Generator generator;
|
||||
|
||||
@ -735,6 +737,10 @@ public class Map implements Disposable {
|
||||
return warps.get(src, -1);
|
||||
}
|
||||
|
||||
public boolean isTown() {
|
||||
return town;
|
||||
}
|
||||
|
||||
public void setPosition(int x, int y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
@ -502,7 +502,7 @@ public class GameScreen extends ScreenAdapter implements LoadingScreen.Loadable
|
||||
|
||||
Map.Zone prevZone = curZone;
|
||||
mapRenderer.update();
|
||||
curZone = map.getZone(player.position());
|
||||
curZone = player.curZone = map.getZone(player.position());
|
||||
if (prevZone != curZone && prevZone != null) {
|
||||
displayEntry();
|
||||
}
|
||||
@ -558,7 +558,7 @@ public class GameScreen extends ScreenAdapter implements LoadingScreen.Loadable
|
||||
Riiablo.music.stop();
|
||||
Riiablo.assets.get(windowopenDescriptor).play();
|
||||
|
||||
Map.instance = map = Riiablo.assets.get(mapDescriptor); // TODO: remove Map.instance
|
||||
Map.instance = map = player.map = Riiablo.assets.get(mapDescriptor); // TODO: remove Map.instance
|
||||
mapRenderer = new MapRenderer(Riiablo.batch, viewport.getWorldWidth(), viewport.getWorldHeight());
|
||||
//mapRenderer = new MapRenderer(Riiablo.batch, 480f * 16f / 9f, 480f);
|
||||
mapRenderer.setMap(map);
|
||||
|
Loading…
Reference in New Issue
Block a user