Skip to content

Commit

Permalink
Fix level up incorrectly
Browse files Browse the repository at this point in the history
  • Loading branch information
reihoron committed Jun 13, 2024
1 parent 8a9ee63 commit e7b61ae
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Level.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class Level extends World {
protected static int totalCoins = 0;
protected static int totalHP = 5;
protected static int numOfCrown = 0;
private static int level = 0;
private final int[] worldSize = {2560, 720};
private final String background = "2dPixelForestBackground.png";
private final Font font = new Font("Arial", 18);
Expand All @@ -17,15 +18,14 @@ public class Level extends World {
protected Player player;
protected SuperDisplayLabel coinLabel = new SuperDisplayLabel(Color.BLACK, Color.WHITE, font);
protected Button saveButton = new Button();
private int level = 0;
private Orb orb;


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

public static void resetCoin() {
Expand All @@ -48,12 +48,13 @@ public void spawnFloor(ImgScroll sc) {

public void checkNext() {
if (orb.isBeingTouched()) {
if (level == 0){
if (level == 0) {
levelUp();
Level1 world = new Level1();
Greenfoot.setWorld(world);
return;
}
if (level == 1){
if (level == 1) {
EndScreen end = new EndScreen();
Greenfoot.setWorld(end);
}
Expand Down

0 comments on commit e7b61ae

Please sign in to comment.