diff --git a/src/main/java/pacmanGame/Cell.java b/src/main/java/pacmanGame/Cell.java index 7e85d0c..ce5247e 100644 --- a/src/main/java/pacmanGame/Cell.java +++ b/src/main/java/pacmanGame/Cell.java @@ -71,6 +71,12 @@ public class Cell { else if(type.equals("crystal")) { triggerCrystal(); } + else if(type.equals("tpLeft")) { + map.gameManager.teleportPlayer("tpRight"); + } + else if(type.equals("tpRight")) { + map.gameManager.teleportPlayer("tpLeft"); + } else { //System.out.println("cell contains no item!"); diff --git a/src/main/java/pacmanGame/GameManager.java b/src/main/java/pacmanGame/GameManager.java index 5206599..b27edfb 100644 --- a/src/main/java/pacmanGame/GameManager.java +++ b/src/main/java/pacmanGame/GameManager.java @@ -72,6 +72,12 @@ public class GameManager { } } + public void teleportPlayer(String destination) { + + player.position = map.findCellByString(destination).pos; + + } + public boolean GhostPlayerColisionTest() { for(int i = 0; i < ghosts.length; i++) { diff --git a/src/main/java/pacmanGame/VisualizerPlainText.java b/src/main/java/pacmanGame/VisualizerPlainText.java index 41ee414..d61ec1a 100644 --- a/src/main/java/pacmanGame/VisualizerPlainText.java +++ b/src/main/java/pacmanGame/VisualizerPlainText.java @@ -18,6 +18,8 @@ public class VisualizerPlainText implements Visualizer { this.put("apple", "@ "); this.put("crystal", "<>"); this.put("pill", "o "); + this.put("tpRight" , " "); + this.put("tpLeft" , " "); }}; public final String ghostSprite = "AA";