Skip to content
Snippets Groups Projects
Commit ff280da5 authored by Azurlors's avatar Azurlors
Browse files

Version 4.0.0

parent 32c74939
No related branches found
No related tags found
No related merge requests found
...@@ -18,6 +18,8 @@ public class MenuPanel { ...@@ -18,6 +18,8 @@ public class MenuPanel {
private JButton button1; private JButton button1;
private JButton button2; private JButton button2;
private JButton button3; private JButton button3;
private JButton button7;
private JButton button8;
private static boolean shootingCharacter = false; private static boolean shootingCharacter = false;
private static boolean normalCharacter = false; private static boolean normalCharacter = false;
...@@ -49,7 +51,13 @@ public class MenuPanel { ...@@ -49,7 +51,13 @@ public class MenuPanel {
private Panel gameMenu; private Panel gameMenu;
private Panel gameChoice; private Panel gameChoice;
private Panel gameChoice2;
private Panel gameFin; private Panel gameFin;
private static int level;
public static int getLevel() {
return level;
}
public boolean isLancementpartie() { public boolean isLancementpartie() {
return lancementpartie; return lancementpartie;
...@@ -114,6 +122,31 @@ public class MenuPanel { ...@@ -114,6 +122,31 @@ public class MenuPanel {
f.getContentPane().remove(gameChoice); f.getContentPane().remove(gameChoice);
} }
public void menuChoice2(){
level = 0;
gameChoice2 = new Panel();
button7 = new JButton("map 1");
button8 = new JButton("map 2");
gameChoice2.add(button7,BorderLayout.CENTER);
gameChoice2.add(button8,BorderLayout.CENTER);
button7.addActionListener(e -> level= 1);
button8.addActionListener(e -> level = 2);
f.getContentPane().add(gameChoice2);
f.setContentPane(gameChoice2);
f.pack();
f.setVisible(true);
f.getContentPane().setFocusable(true);
while(level == 0){
try {
Thread.sleep(1);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
f.getContentPane().remove(gameChoice2);
}
public void menufin(){ public void menufin(){
resetCharacter(); resetCharacter();
gameFin= new Panel(new FlowLayout(FlowLayout.CENTER)); gameFin= new Panel(new FlowLayout(FlowLayout.CENTER));
......
...@@ -154,8 +154,6 @@ public class Character extends Entity{ ...@@ -154,8 +154,6 @@ public class Character extends Entity{
if (cof.key) { if (cof.key) {
this.key += 1; this.key += 1;
cof.key = false; cof.key = false;
System.out.print("Tu as trouvé une clée!");
} }
} }
} }
......
...@@ -64,13 +64,7 @@ public class Jeu implements Game{ ...@@ -64,13 +64,7 @@ public class Jeu implements Game{
//liste des coeurs drop par les monstres //liste des coeurs drop par les monstres
private static final List<Hearth> hearthList = new ArrayList<>(); private static final List<Hearth> hearthList = new ArrayList<>();
//Sol du niveau 1 : public static Obstacle sol;
//public static Obstacle sol = new Obstacle(new HitBox(new Coordonnees(200,1216),1,1000000));
//Sol du niveau 2 :
public static Obstacle sol = new Obstacle(new HitBox(new Coordonnees(200,1664),1,1000000));
public static List<Obstacle> obstacleTable = new ArrayList<>(); public static List<Obstacle> obstacleTable = new ArrayList<>();
private static List<Monster> monsterList = new ArrayList<>(); private static List<Monster> monsterList = new ArrayList<>();
...@@ -79,16 +73,11 @@ public class Jeu implements Game{ ...@@ -79,16 +73,11 @@ public class Jeu implements Game{
public final static int TILES_DEFAULT_SIZE=32; public final static int TILES_DEFAULT_SIZE=32;
public final static float SCALE=1.0f; public final static float SCALE=1.0f;
//Taille fenêtre niveau 1 : public static int TILES_IN_WIDTH;
public static int TILES_IN_HEIGHT;
//public final static int TILES_IN_WIDTH = 132;
//public final static int TILES_IN_HEIGHT = 46;
//Taille fenêtre niveau 2 :
public final static int TILES_IN_WIDTH = 152;
public final static int TILES_IN_HEIGHT = 60;
public final static int TILES_SIZE = (int) (TILES_DEFAULT_SIZE*SCALE); public final static int TILES_SIZE = (int) (TILES_DEFAULT_SIZE*SCALE);
public static final LevelManager levelManager = new LevelManager(); public static LevelManager levelManager;
public Jeu(String source) { public Jeu(String source) {
...@@ -125,11 +114,27 @@ public class Jeu implements Game{ ...@@ -125,11 +114,27 @@ public class Jeu implements Game{
directionJeu.put("Left", false); directionJeu.put("Left", false);
directionJeu.put("Jump", false); directionJeu.put("Jump", false);
directionJeu.put("Attack",false); directionJeu.put("Attack",false);
// on génère le level manager
//on genere la table des obstacles
obstacleTable= levelManager.generateObstacleTable(); if(engine.MenuPanel.getLevel() == 1) {
obstacleTable.add(sol); TILES_IN_WIDTH = 132;
TILES_IN_HEIGHT = 46;
levelManager = new LevelManager("LEVEL_ONE");
obstacleTable= levelManager.generateObstacleTable();
sol = new Obstacle(new HitBox(new Coordonnees(200,1216),1,1000000));
obstacleTable.add(sol);
}
else if(engine.MenuPanel.getLevel() == 2) {
TILES_IN_WIDTH = 152;
TILES_IN_HEIGHT = 60;
levelManager = new LevelManager("LEVEL_TWO");
obstacleTable= levelManager.generateObstacleTable();
sol = new Obstacle(new HitBox(new Coordonnees(200,1664),1,1000000));
obstacleTable.add(sol);
}
......
...@@ -142,14 +142,6 @@ public class Painter implements GamePainter{ ...@@ -142,14 +142,6 @@ public class Painter implements GamePainter{
private void drawCoffre(Graphics2D crayon, Coffre coffre){ private void drawCoffre(Graphics2D crayon, Coffre coffre){
HashMap<String, Coordonnees> extremites = coffre.getHitbox().getExtremites(); HashMap<String, Coordonnees> extremites = coffre.getHitbox().getExtremites();
Coordonnees coffreCenter = coffre.getHitbox().getCentre(); Coordonnees coffreCenter = coffre.getHitbox().getCentre();
Coordonnees hd = extremites.get("HautDroite");
Coordonnees bd = extremites.get("BasDroite");
Coordonnees hg = extremites.get("HautGauche");
Coordonnees bg = extremites.get("BasGauche");
crayon.drawLine((int)hd.getX() - xCam,(int)hd.getZ() - zCam,(int)bd.getX() - xCam,(int)bd.getZ() - zCam);
crayon.drawLine((int)bd.getX() - xCam,(int)bd.getZ() - zCam,(int)bg.getX() - xCam,(int)bg.getZ() - zCam);
crayon.drawLine((int)bg.getX() - xCam,(int)bg.getZ() - zCam,(int)hg.getX() - xCam,(int)hg.getZ() - zCam);
crayon.drawLine((int)hg.getX() - xCam,(int)hg.getZ() - zCam,(int)hd.getX() - xCam,(int)hd.getZ() - zCam);
crayon.drawImage(coffre.getImage(), (int)coffreCenter.getX() - (int) coffre.getHitbox().getWidth()/2 -xCam,(int) coffreCenter.getZ() - (int) coffre.getHitbox().getHeight()/2 -zCam,null,null); crayon.drawImage(coffre.getImage(), (int)coffreCenter.getX() - (int) coffre.getHitbox().getWidth()/2 -xCam,(int) coffreCenter.getZ() - (int) coffre.getHitbox().getHeight()/2 -zCam,null,null);
} }
......
...@@ -76,7 +76,6 @@ public class LoadSave { ...@@ -76,7 +76,6 @@ public class LoadSave {
//Bat //Bat
if (86<=value && value <= 95) { if (86<=value && value <= 95) {
copyValue = 46; copyValue = 46;
System.out.println(i);
} }
//Boss //Boss
if (96<=value && value <= 105) if (96<=value && value <= 105)
...@@ -87,7 +86,6 @@ public class LoadSave { ...@@ -87,7 +86,6 @@ public class LoadSave {
//Terre horizontale de 7 de longueur //Terre horizontale de 7 de longueur
if (226<=value && value <= 235) { if (226<=value && value <= 235) {
copyValue = 121; copyValue = 121;
System.out.println("terre");
} }
//Terre verticale de 6 de hauteur //Terre verticale de 6 de hauteur
if (236<=value && value <= 245) if (236<=value && value <= 245)
...@@ -96,7 +94,6 @@ public class LoadSave { ...@@ -96,7 +94,6 @@ public class LoadSave {
//Terre verticale de 20 de hauteur //Terre verticale de 20 de hauteur
if (46<=value && value <= 55) { if (46<=value && value <= 55) {
copyValue = 29; copyValue = 29;
System.out.println(i);
} }
...@@ -120,7 +117,6 @@ public class LoadSave { ...@@ -120,7 +117,6 @@ public class LoadSave {
//Liste des valeurs //Liste des valeurs
lvlData[j][i] = copyValue; lvlData[j][i] = copyValue;
if (lvlData[j][i]==121){ if (lvlData[j][i]==121){
System.out.println("terre cree");
} }
} }
return lvlData; return lvlData;
......
...@@ -24,10 +24,16 @@ public class LevelManager { ...@@ -24,10 +24,16 @@ public class LevelManager {
private int indexBoss; private int indexBoss;
private int indexPorte; private int indexPorte;
public LevelManager() { public LevelManager(String a) {
importOutsideSprites(); if (a == "LEVEL_TWO") {
levelOne = new Level(LoadSave.GetLevelData(LoadSave.LEVEL_TWO)); importOutsideSprites();
//levelTwo = new Level(LoadSave.GetLevelData(LoadSave.LEVEL_TWO)); levelOne = new Level(LoadSave.GetLevelData(LoadSave.LEVEL_TWO));
//levelTwo = new Level(LoadSave.GetLevelData(LoadSave.LEVEL_TWO));
} else if (a == "LEVEL_ONE") {
importOutsideSprites();
levelOne = new Level(LoadSave.GetLevelData(LoadSave.LEVEL_ONE));
//levelTwo = new Level(LoadSave.GetLevelData(LoadSave.LEVEL_TWO));
}
} }
private BufferedImage[] importOutsideSprites() { private BufferedImage[] importOutsideSprites() {
...@@ -195,7 +201,6 @@ public class LevelManager { ...@@ -195,7 +201,6 @@ public class LevelManager {
} }
} }
} }
System.out.println(monsterList);
return monsterList; return monsterList;
} }
......
...@@ -23,6 +23,8 @@ public class Main { ...@@ -23,6 +23,8 @@ public class Main {
menu.menudebut(); menu.menudebut();
Thread.sleep(2); Thread.sleep(2);
menu.menuChoice(); menu.menuChoice();
Thread.sleep(2);
menu.menuChoice2();
// creation du jeu particulier et de son afficheur // creation du jeu particulier et de son afficheur
Jeu game = new Jeu("helpFilePacman.txt"); Jeu game = new Jeu("helpFilePacman.txt");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment