Small fix

This commit is contained in:
0nlineSam 2024-11-02 13:35:07 +01:00
parent 3dca3338e8
commit ff13dca39e

View File

@ -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);