From ff13dca39eefcab96abf1440bb341bd80d8ba301 Mon Sep 17 00:00:00 2001 From: 0nlineSam Date: Sat, 2 Nov 2024 13:35:07 +0100 Subject: [PATCH] Small fix --- src/fr/enssat/BoulderDash/views/GroundView.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/fr/enssat/BoulderDash/views/GroundView.java b/src/fr/enssat/BoulderDash/views/GroundView.java index 9ac1c02f..c37d4d0a 100644 --- a/src/fr/enssat/BoulderDash/views/GroundView.java +++ b/src/fr/enssat/BoulderDash/views/GroundView.java @@ -43,9 +43,8 @@ public abstract class GroundView extends JPanel implements Observer { */ public void drawTerrain(int width, int height, Graphics g) { // Draw items + drawBackground(width, height, g); if (this.levelModel.getMode() == "game") { - drawGameTerrain(width, height, g); - if(!this.levelModel.isGameRunning()) { if(!this.levelModel.getRockford().getHasExplosed()) { this.displayWin(); @@ -54,7 +53,6 @@ public abstract class GroundView extends JPanel implements Observer { } } } else { - drawGameTerrain(width, height, g); if (this.levelModel.getShowCursor()) { g.drawImage( this.levelModel.getCursorImage(), @@ -67,13 +65,13 @@ public abstract class GroundView extends JPanel implements Observer { } /** - * Draws the game terrain + * Draws the background of the game * * @param width Map width * @param height Map height * @param g Map graphical object */ - private void drawGameTerrain(int width, int height, Graphics g) { + private void drawBackground(int width, int height, Graphics g) { for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { g.drawImage(this.levelModel.getImage(x, y), (x * 16), (y * 16), this);