Skip to content

Commit

Permalink
Fix issues caused by level int not being reset
Browse files Browse the repository at this point in the history
  • Loading branch information
reihoron committed Jun 13, 2024
1 parent e7b61ae commit cf401e6
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 76 deletions.
12 changes: 12 additions & 0 deletions Level.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ public Level() {
setPaintOrder(Button.class, SuperDisplayLabel.class, Tile.class);
}

public Level(int level) {
super(1280, 720, 1, false);
saveButtonImage.scale(150, 60);
saveButton.setImage(saveButtonImage);
setPaintOrder(Button.class, SuperDisplayLabel.class, Tile.class);
setLevel(level);
}

public static void resetCoin() {
totalCoins = 0;
}
Expand Down Expand Up @@ -61,6 +69,10 @@ public void checkNext() {
}
}

public void setLevel(int level) {
Level.level = level;
}

public int[] getWorldSize() {
return worldSize;
}
Expand Down
3 changes: 2 additions & 1 deletion Level0.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public Level0() {
updateCoin(coinLabel);
resetCoin();
setHP(5);
setLevel(0);

int[][] blockGeneration = loadLevel(0);
spawnTerrain(blockGeneration);
Expand All @@ -34,7 +35,7 @@ public Level0() {
public void act() {
followPlayer(scroll, player);
updateCoin(coinLabel);
saveButton.setLocation(getWidth()-100, 40);
saveButton.setLocation(getWidth() - 100, 40);
checkSaveButton();
checkNext();
}
Expand Down
Loading

0 comments on commit cf401e6

Please sign in to comment.