Adding all levels + linking buttons
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
to create new level just do `gradle -q --console plain -PmainClass=school_project.Parsers.FileParserFactory run` Co-authored-by: Anthony Debucquoy <debucquoy.anthony@gmail.com> Reviewed-on: #56 Reviewed-by: Mat_02 <diletomatteo@gmail.com>
This commit is contained in:
@ -7,6 +7,11 @@ import javafx.scene.layout.ColumnConstraints;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.RowConstraints;
|
||||
import school_project.Controller;
|
||||
import school_project.GameUI;
|
||||
import school_project.Parsers.FileParserFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class MenuLevel extends GridPane {
|
||||
private int StartLevel;
|
||||
@ -60,30 +65,38 @@ public class MenuLevel extends GridPane {
|
||||
//It's here that I put all buttons where I need (base on column not row)
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 1; j < 5; j++) {
|
||||
Button levelButton = new Button("level "+(StartLevel));
|
||||
levelButton.setOnAction(event -> {
|
||||
try {
|
||||
String levelName = ((Button)event.getSource()).getText().replace(" ", "") + ".level";
|
||||
System.out.println(levelName);
|
||||
GameUI level = new GameUI(FileParserFactory.loadMapFromFile(new File(Controller.class.getResource("levels/" + levelName).getFile())));
|
||||
Controller.switchRoot(level);
|
||||
} catch (IOException e) {
|
||||
System.out.println("Le niveau " + StartLevel + "n'existe pas.");
|
||||
}
|
||||
});
|
||||
if(i==0){
|
||||
Button Level = new Button("level "+(StartLevel));
|
||||
StartLevel+=3;
|
||||
add(Level,i,j);
|
||||
setHalignment(Level,HPos.CENTER);
|
||||
add(levelButton,i,j);
|
||||
setHalignment(levelButton,HPos.CENTER);
|
||||
if(j==4){
|
||||
StartLevel-=11;
|
||||
}
|
||||
}
|
||||
else if(i==1&&j!=4) {
|
||||
Button Level = new Button("level "+(StartLevel));
|
||||
StartLevel += 3;
|
||||
add(Level, i, j);
|
||||
setHalignment(Level,HPos.CENTER);
|
||||
add(levelButton, i, j);
|
||||
setHalignment(levelButton,HPos.CENTER);
|
||||
if (j == 3) {
|
||||
StartLevel -=8;
|
||||
|
||||
}
|
||||
}
|
||||
else if(i==2&&j!=4){
|
||||
Button Level = new Button("level "+(StartLevel));
|
||||
StartLevel+=3;
|
||||
add(Level,i,j);
|
||||
setHalignment(Level,HPos.CENTER);
|
||||
add(levelButton,i,j);
|
||||
setHalignment(levelButton,HPos.CENTER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1 @@
|
||||
SMS<03><13>SME
|
@ -0,0 +1 @@
|
||||
SMS<04><>"<22>"<22>"p1<70>SME
|
@ -0,0 +1 @@
|
||||
SMS<05><><EFBFBD><EFBFBD>"<22>1<EFBFBD><13>2<EFBFBD>"p3<70><33>SME
|
@ -0,0 +1 @@
|
||||
SMS?<3F><><EFBFBD><EFBFBD><13>"<22>3<EFBFBD><33><13>"<22>2<EFBFBD>3<EFBFBD><33>SME
|
@ -0,0 +1 @@
|
||||
SMSf<><66><EFBFBD>< 1<>"<22>"p<11>&<26><>"<22>"<22>"<22><13>SME
|
@ -0,0 +1 @@
|
||||
SMS<05><><EFBFBD>"<22>1<EFBFBD><11>"p#<23><12>!<21>SME
|
@ -0,0 +1 @@
|
||||
SMS<05><><EFBFBD><EFBFBD>"<22><13><11>"p3<70><33>3o<33>SME
|
@ -0,0 +1 @@
|
||||
SMS<06><><EFBFBD><EFBFBD><EFBFBD>3<><33>3<EFBFBD><33>1<EFBFBD>1<EFBFBD>#<23>#<23>SME
|
BIN
app/src/main/resources/school_project/levels/level18.level
Normal file
BIN
app/src/main/resources/school_project/levels/level18.level
Normal file
Binary file not shown.
@ -0,0 +1 @@
|
||||
SMS<06><><EFBFBD><EFBFBD><EFBFBD><13>3<EFBFBD><33>3o<33>4<34>"<22>SME
|
@ -0,0 +1 @@
|
||||
SMS<01>1<>SME
|
@ -0,0 +1 @@
|
||||
SMS<05><><EFBFBD><EFBFBD><12>3<EFBFBD><33>"<22>2<EFBFBD>3<EFBFBD><33>SME
|
BIN
app/src/main/resources/school_project/levels/level21.level
Normal file
BIN
app/src/main/resources/school_project/levels/level21.level
Normal file
Binary file not shown.
@ -0,0 +1 @@
|
||||
SMS<05><><EFBFBD><EFBFBD>"p<13><12>"<22>#<23>#<23>#<23>SME
|
@ -0,0 +1 @@
|
||||
SMS<05><><EFBFBD><EFBFBD>2<><13>"<22>#<23>#<23>BSME
|
@ -0,0 +1 @@
|
||||
SMSv<><76><EFBFBD>#<23><11><11>#<23>#<23>BSME
|
@ -0,0 +1 @@
|
||||
SMS<06><><EFBFBD><EFBFBD><EFBFBD>#<23>#|!<21>#\#<23>2<EFBFBD>2<EFBFBD>BSME
|
BIN
app/src/main/resources/school_project/levels/level26.level
Normal file
BIN
app/src/main/resources/school_project/levels/level26.level
Normal file
Binary file not shown.
@ -0,0 +1 @@
|
||||
SMS<06><><EFBFBD><EFBFBD><EFBFBD>#<23>#<23>!<21>!<21>#<23>4<34>3o<33>SME
|
@ -0,0 +1 @@
|
||||
SMS<07><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2<>B#|3?<3F>3<EFBFBD><33>#<23>&<26><>SME
|
@ -0,0 +1 @@
|
||||
SMSy<><79>y<EFBFBD>B<>!<21>B<EFBFBD>$<24>#<23>#<23>SME
|
@ -0,0 +1 @@
|
||||
SMS<03><>#<23><13>SME
|
@ -0,0 +1 @@
|
||||
SMS<07><><EFBFBD>}<7D>߀$<24>3ۀ2<DB80><11><11>"<22>2x"p2<70>"<22>2<EFBFBD>SME
|
@ -0,0 +1 @@
|
||||
SMS<04><>#<23>#<23><11>1<EFBFBD>SME
|
@ -0,0 +1 @@
|
||||
SMS<>p<11><11>1<EFBFBD>#<23>#<23>SME
|
@ -0,0 +1 @@
|
||||
SMS<>3<><33><13>1<EFBFBD>SME
|
@ -0,0 +1 @@
|
||||
SMS3<>2<><13>"<22>SME
|
@ -0,0 +1 @@
|
||||
SMS<05><><EFBFBD><EFBFBD>2<>"<22>"<22>"p1<70><11>1<EFBFBD>"pSME
|
@ -0,0 +1 @@
|
||||
SMS<05><>߀1<>1<EFBFBD>3<EFBFBD><33>#<23>"<22>SME
|
Reference in New Issue
Block a user