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