mirror of
https://github.com/Klagarge/PokeHES.git
synced 2025-07-07 17:01:10 +00:00
should work
This commit is contained in:
@ -59,24 +59,18 @@ public class ScreenMap extends RenderingScreen{
|
||||
|
||||
tiledLayer.clear();
|
||||
|
||||
// Get actual map of the player
|
||||
try { map = player.getMap(); } catch (Exception e) { System.out.println("error for get map");}
|
||||
try { map = player.getMap(); } catch (Exception e) {}
|
||||
|
||||
// Get all layers on the current map
|
||||
for (int i = 0; i < 50; i++) {
|
||||
for (int i = 0; i < 50; i++) {
|
||||
try { tiledLayer.add((TiledMapTileLayer) tMap.get(map).getLayers().get(i)); } catch (Exception e) { }
|
||||
}
|
||||
|
||||
// Get heigh and width of tiles and the size of the tiles
|
||||
TiledMapTileLayer tl = tiledLayer.get(0);
|
||||
width = tl.getWidth();
|
||||
tileWidth = (int) tl.getTileWidth();
|
||||
height = tl.getHeight();
|
||||
tileHeight = (int) tl.getTileHeight();
|
||||
|
||||
// System.out.println(width + " x " + height + " - " + tileWidth + " x " + tileHeight);
|
||||
|
||||
// Get all doors on the current map
|
||||
//System.out.println(width + " x " + height + " - " + tileWidth + " x " + tileHeight);
|
||||
try {
|
||||
doors = tMap.get(map).getLayers().get("door").getObjects();
|
||||
} catch (Exception e) { doors = null; }
|
||||
@ -84,7 +78,8 @@ public class ScreenMap extends RenderingScreen{
|
||||
|
||||
// Render the tileMap
|
||||
g.zoom(zoom);
|
||||
g.moveCamera((int)player.getPosition().x, (int)player.getPosition().y, width * tileWidth, height * tileHeight);
|
||||
try {g.moveCamera(player.getPosition().x, player.getPosition().y, width * tileWidth, height * tileHeight);}
|
||||
catch (Exception e) {System.out.println("Fail to move camera");}
|
||||
|
||||
tMapRenderer.get(map).setView(g.getCamera());
|
||||
tMapRenderer.get(map).render();
|
||||
@ -111,11 +106,10 @@ public class ScreenMap extends RenderingScreen{
|
||||
|
||||
public boolean isWalkable(Vector<TiledMapTile> tile) {
|
||||
if (tile == null) return false;
|
||||
if (tile.size() == 0) return false;
|
||||
boolean walkable = true;
|
||||
boolean walkable = false;
|
||||
for (TiledMapTile tiledMapTile : tile) {
|
||||
Object test = tiledMapTile.getProperties().get("walkable");
|
||||
walkable = Boolean.parseBoolean(test.toString()) ? walkable:false;
|
||||
walkable = Boolean.parseBoolean(test.toString()) ? true:walkable;
|
||||
}
|
||||
return walkable;
|
||||
}
|
||||
@ -156,7 +150,6 @@ public class ScreenMap extends RenderingScreen{
|
||||
try { Door.nextMap = mapProperties.get("nextMap").toString(); } catch (Exception e) { }
|
||||
try { Door.nextX = Integer.parseInt(mapProperties.get("nextX").toString()); } catch (Exception e) { }
|
||||
try { Door.nextY = Integer.parseInt(mapProperties.get("nextY").toString()); } catch (Exception e) { }
|
||||
try { Door.direction = Player.Direction.valueOf(mapProperties.get("nextDirection").toString()); } catch (Exception e) { }
|
||||
}
|
||||
}
|
||||
|
||||
@ -167,13 +160,11 @@ public class ScreenMap extends RenderingScreen{
|
||||
public static String nextMap;
|
||||
public static Integer nextX;
|
||||
public static Integer nextY;
|
||||
public static Player.Direction direction;
|
||||
|
||||
public static void reset(){
|
||||
nextMap = null;
|
||||
nextX = null;
|
||||
nextY = null;
|
||||
direction = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user