Adding all levels + linking buttons
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:
Debucquoy Anthony 2023-05-17 23:42:44 +02:00
parent ff167b4d0f
commit ac6c8611e7
32 changed files with 53 additions and 10 deletions

View File

@ -29,7 +29,7 @@ dependencies {
application {
// Define the main class for the application.
mainClass = 'school_project.Controller'
mainClass = project.hasProperty("mainClass") ? project.getProperty("mainClass") : 'school_project.Controller'
}
javafx {
@ -41,3 +41,7 @@ tasks.named('test') {
// Use JUnit Platform for unit tests.
useJUnitPlatform()
}
run{
standardInput = System.in
}

View File

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

View File

@ -0,0 +1 @@
SMSààSME

View File

@ -0,0 +1 @@
SMS<04><>"<22>"<22>"p1<70>SME

View File

@ -0,0 +1 @@
SMSÿÿÿ€"°1àà2ü"p3í€SME

View File

@ -0,0 +1 @@
SMS?ÿÿýðà"°3í€à"ð2ü3í€SME

View File

@ -0,0 +1 @@
SMSfÿÿŸ< 1à"°"p€&ÿð"ð"ð"°àSME

View File

@ -0,0 +1 @@
SMSÿÿð"°1à€"p#üÀ!ÀSME

View File

@ -0,0 +1 @@
SMS˙˙˙€ŕ€"p3í€3o€SME

View File

@ -0,0 +1 @@
SMSÿÿÿÿð3ÿ€3í€1à1à#ü#üSME

View File

@ -0,0 +1 @@
SMSó˙˙óŕŕ3ü€3o€4đ"°SME

View File

@ -0,0 +1 @@
SMSà1àSME

View File

@ -0,0 +1 @@
SMSÿÿÿ€À3í€"ð2ø3ü€SME

View File

@ -0,0 +1 @@
SMSÿÿÿ€"pàÀ"°#ü#è#èSME

View File

@ -0,0 +1 @@
SMSÿÿÿ€à"Ð#è#¼BSME

View File

@ -0,0 +1 @@
SMSv˙˙€€#ě#ĽBSME

View File

@ -0,0 +1 @@
SMSÿÿÿÿð#¼#|!À#\#ü2ô2äBSME

View File

@ -0,0 +1 @@
SMSÿÿÿÿð#ø#´!À!À#¼4ð3o€SME

View File

@ -0,0 +1 @@
SMS<07><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2<>B#|3?<3F>3<EFBFBD><33>#<23>&<26><>SME

View File

@ -0,0 +1 @@
SMSy<><79>y<EFBFBD>B<>!<21>B<EFBFBD>$<24>#<23>#<23>SME

View File

@ -0,0 +1 @@
SMS<03><>#<23><13>SME

View File

@ -0,0 +1 @@
SMS<07><><EFBFBD>}<7D>߀ $<24>3ۀ2<DB80><11><11>"<22>2x"p2<70>"<22>2<EFBFBD>SME

View File

@ -0,0 +1 @@
SMS<04><>#<23>#<23><11>1<EFBFBD>SME

View File

@ -0,0 +1 @@
SMS÷p€1à#ü#üSME

View File

@ -0,0 +1 @@
SMSÿ3ÿ€à1àSME

View File

@ -0,0 +1 @@
SMS3ÿà"°SME

View File

@ -0,0 +1 @@
SMSÿÿÿ€2ü"°"°"p1à€1à"pSME

View File

@ -0,0 +1 @@
SMSÿÿ߀1à1à3ÿ€#ü"°SME