From c5bf23fb08ed635455d19e0f1938062154b0e5ad Mon Sep 17 00:00:00 2001 From: fdai2751 Date: Mon, 5 Feb 2024 23:25:42 +0100 Subject: [PATCH] display paused state --- .../java/pacmanGame/VisualizerPlainText.java | 54 ++++++++++++------- 1 file changed, 34 insertions(+), 20 deletions(-) diff --git a/src/main/java/pacmanGame/VisualizerPlainText.java b/src/main/java/pacmanGame/VisualizerPlainText.java index 7591711..33514d9 100644 --- a/src/main/java/pacmanGame/VisualizerPlainText.java +++ b/src/main/java/pacmanGame/VisualizerPlainText.java @@ -36,30 +36,44 @@ public class VisualizerPlainText implements Visualizer { for(int y = 0; y < map.size.y; y++) { for(int x = 0; x < map.size.x; x++) { Cell cell = map.GetCell(new Vector2(x, map.size.y - 1 - y)); - boolean containsGhosts = false; - boolean containsPlayer = false; - for( int i = 0; i < gameManager.ghosts.length; i++) { - if(gameManager.ghosts[i].position.equals(cell.pos)) { - containsGhosts = true; - } - } - if(gameManager.player.position.equals(cell.pos)) { - containsPlayer = true; - } - if(containsPlayer) { - output += playerSprite; - } - else if(containsGhosts) { - output += ghostSprite; - } - else if (sprites.containsKey(cell.type)) { - - output += sprites.get(cell.type); + if(gameManager.isPaused && 5 < y && y <= 10){ + if(x == 0) { + if(y == 8){ + output += "Game Paused!"; + } + else { + output += ""; + } + } } else { - System.out.println("unknown type" + cell.type); + boolean containsGhosts = false; + boolean containsPlayer = false; + for( int i = 0; i < gameManager.ghosts.length; i++) { + if(gameManager.ghosts[i].position.equals(cell.pos)) { + containsGhosts = true; + } + } + if(gameManager.player.position.equals(cell.pos)) { + containsPlayer = true; + } + + if(containsPlayer) { + output += playerSprite; + } + else if(containsGhosts) { + output += ghostSprite; + } + else if (sprites.containsKey(cell.type)) { + + output += sprites.get(cell.type); + } + else { + System.out.println("unknown type" + cell.type); + } } + } output += "\n"; }