mirror of
https://github.com/Klagarge/PokeHES.git
synced 2024-11-30 04:33:27 +00:00
fix done
This commit is contained in:
parent
50760ddfd5
commit
ceb71643b1
@ -14,7 +14,7 @@ public class Player extends Character{
|
|||||||
|
|
||||||
private int xp;
|
private int xp;
|
||||||
public Enemy lastEnemy = null;
|
public Enemy lastEnemy = null;
|
||||||
public boolean frontOfEnemy = false;
|
public boolean onEnemy = false;
|
||||||
|
|
||||||
public Player(int x, int y, String map) {
|
public Player(int x, int y, String map) {
|
||||||
super("Player", x, y, "Character", map);
|
super("Player", x, y, "Character", map);
|
||||||
@ -32,7 +32,7 @@ public class Player extends Character{
|
|||||||
// Compute direction and next cell
|
// Compute direction and next cell
|
||||||
Vector<TiledMapTile> nextCell = new Vector<>();
|
Vector<TiledMapTile> nextCell = new Vector<>();
|
||||||
Player.Direction goalDirection = Player.Direction.NULL;
|
Player.Direction goalDirection = Player.Direction.NULL;
|
||||||
Vector2 nextPos = position;
|
Vector2 nextPos = new Vector2(position);
|
||||||
|
|
||||||
if (c.keyStatus.get(Input.Keys.RIGHT)) {
|
if (c.keyStatus.get(Input.Keys.RIGHT)) {
|
||||||
goalDirection = Player.Direction.RIGHT;
|
goalDirection = Player.Direction.RIGHT;
|
||||||
@ -76,6 +76,7 @@ public class Player extends Character{
|
|||||||
nMap = ScreenMap.Door.nextMap;
|
nMap = ScreenMap.Door.nextMap;
|
||||||
x = ScreenMap.Door.nextX;
|
x = ScreenMap.Door.nextX;
|
||||||
y = ScreenMap.Door.nextY;
|
y = ScreenMap.Door.nextY;
|
||||||
|
goalDirection = ScreenMap.Door.nextDirection;
|
||||||
} catch (Exception e) { }
|
} catch (Exception e) { }
|
||||||
ScreenMap.Door.reset();
|
ScreenMap.Door.reset();
|
||||||
if (nMap == null || x == null || y == null) return;
|
if (nMap == null || x == null || y == null) return;
|
||||||
@ -97,7 +98,7 @@ public class Player extends Character{
|
|||||||
|
|
||||||
if(bMap && pX==eX && pY==eY) {
|
if(bMap && pX==eX && pY==eY) {
|
||||||
lastEnemy = enemy;
|
lastEnemy = enemy;
|
||||||
frontOfEnemy = true;
|
onEnemy = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ public class PokeMudry extends PortableApplication {
|
|||||||
if(onMapScreen) sp.p.manageEntity(sp.sm, controller);
|
if(onMapScreen) sp.p.manageEntity(sp.sm, controller);
|
||||||
|
|
||||||
// Switch screen
|
// Switch screen
|
||||||
if (sp.p.frontOfEnemy && onMapScreen){
|
if (sp.p.onEnemy && onMapScreen){
|
||||||
sp.e = sp.p.lastEnemy;
|
sp.e = sp.p.lastEnemy;
|
||||||
sp.sb = sp.screenManager.getScreenBattle();
|
sp.sb = sp.screenManager.getScreenBattle();
|
||||||
sp.b = new Battle(sp.e);
|
sp.b = new Battle(sp.e);
|
||||||
|
@ -71,15 +71,15 @@ public class ScreenMap extends RenderingScreen{
|
|||||||
tileHeight = (int) tl.getTileHeight();
|
tileHeight = (int) tl.getTileHeight();
|
||||||
|
|
||||||
//System.out.println(width + " x " + height + " - " + tileWidth + " x " + tileHeight);
|
//System.out.println(width + " x " + height + " - " + tileWidth + " x " + tileHeight);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
doors = tMap.get(map).getLayers().get("door").getObjects();
|
doors = tMap.get(map).getLayers().get("door").getObjects();
|
||||||
} catch (Exception e) { doors = null; }
|
} catch (Exception e) { doors = null; }
|
||||||
|
|
||||||
|
|
||||||
// Render the tileMap
|
// Render the tileMap
|
||||||
g.zoom(zoom);
|
//g.zoom(zoom);
|
||||||
try {g.moveCamera(player.getPosition().x, player.getPosition().y, width * tileWidth, height * tileHeight);}
|
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).setView(g.getCamera());
|
||||||
tMapRenderer.get(map).render();
|
tMapRenderer.get(map).render();
|
||||||
@ -150,6 +150,7 @@ public class ScreenMap extends RenderingScreen{
|
|||||||
try { Door.nextMap = mapProperties.get("nextMap").toString(); } catch (Exception e) { }
|
try { Door.nextMap = mapProperties.get("nextMap").toString(); } catch (Exception e) { }
|
||||||
try { Door.nextX = Integer.parseInt(mapProperties.get("nextX").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.nextY = Integer.parseInt(mapProperties.get("nextY").toString()); } catch (Exception e) { }
|
||||||
|
try { Door.nextDirection = Door.nextDirection.valueOf(mapProperties.get("nextDirection").toString()); } catch (Exception e) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,11 +161,13 @@ public class ScreenMap extends RenderingScreen{
|
|||||||
public static String nextMap;
|
public static String nextMap;
|
||||||
public static Integer nextX;
|
public static Integer nextX;
|
||||||
public static Integer nextY;
|
public static Integer nextY;
|
||||||
|
public static Player.Direction nextDirection;
|
||||||
|
|
||||||
public static void reset(){
|
public static void reset(){
|
||||||
nextMap = null;
|
nextMap = null;
|
||||||
nextX = null;
|
nextX = null;
|
||||||
nextY = null;
|
nextY = null;
|
||||||
|
nextDirection = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user