Skip to content
Snippets Groups Projects
Commit 96021926 authored by BRUGNEAUX Louis's avatar BRUGNEAUX Louis
Browse files

Map

parent 0bdce07f
Branches
No related tags found
No related merge requests found
...@@ -10,7 +10,7 @@ import java.awt.image.BufferedImage; ...@@ -10,7 +10,7 @@ import java.awt.image.BufferedImage;
import javax.swing.JPanel; import javax.swing.JPanel;
import static jeu.Jeu.getGameCharacter; import static jeu.Jeu.getGameCharacter;
import map.LevelManager;
public class DrawingPanel extends JPanel { public class DrawingPanel extends JPanel {
/** /**
...@@ -36,6 +36,7 @@ public class DrawingPanel extends JPanel { ...@@ -36,6 +36,7 @@ public class DrawingPanel extends JPanel {
/** /**
* la taille des images * la taille des images
*/ */
private LevelManager levelManager;
private int width, height; private int width, height;
/** /**
......
...@@ -43,6 +43,8 @@ public abstract class Entity { ...@@ -43,6 +43,8 @@ public abstract class Entity {
for (int i = 0;i<getObstacleTable().size();i++){ for (int i = 0;i<getObstacleTable().size();i++){
obstacleTableCollision.add(NONE); obstacleTableCollision.add(NONE);
} }
nbMaxFramesInvicible = 100; nbMaxFramesInvicible = 100;
} }
public void deplacements(){} public void deplacements(){}
......
...@@ -18,8 +18,10 @@ import entity.ShootingCharacter; ...@@ -18,8 +18,10 @@ import entity.ShootingCharacter;
import engine.Game; import engine.Game;
import environnement.Coordonnees; import environnement.Coordonnees;
import environnement.HitBox; import environnement.HitBox;
import loaders.ObstacleLoader;
import map.Obstacle; import map.Obstacle;
import loaders.CharacterLoader; import loaders.CharacterLoader;
import map.LevelManager;
public class Jeu implements Game{ public class Jeu implements Game{
...@@ -29,7 +31,7 @@ public class Jeu implements Game{ ...@@ -29,7 +31,7 @@ public class Jeu implements Game{
//Coordonees de debut du personnage //Coordonees de debut du personnage
static final double zdebut = 300; static final double zdebut = 0;
static final double xdebut = 300; static final double xdebut = 300;
//perso //perso
...@@ -60,12 +62,16 @@ public class Jeu implements Game{ ...@@ -60,12 +62,16 @@ public class Jeu implements Game{
public static Obstacle sol = new Obstacle(new HitBox(new Coordonnees(200,700),1,1000000)); public static Obstacle sol = new Obstacle(new HitBox(new Coordonnees(200,700),1,1000000));
private 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<>();
private static List<Kunai> kunaiList = new ArrayList<>(); private static List<Kunai> kunaiList = new ArrayList<>();
//private static List<Coffre> coffreTable = new ArrayList<>(); //private static List<Coffre> coffreTable = new ArrayList<>();
public final static int TILES_DEFAULT_SIZE=32;
public final static float SCALE=1.5f;
public final static int TILES_IN_WIDTH = 60;
public final static int TILES_IN_HEIGHT = 20;
public final static int TILES_SIZE = (int) (TILES_DEFAULT_SIZE*SCALE);
public Jeu(String source) { public Jeu(String source) {
...@@ -80,7 +86,11 @@ public class Jeu implements Game{ ...@@ -80,7 +86,11 @@ public class Jeu implements Game{
characterSkinPath = beginPath + movement + numberOfMovement + ".png"; // path premiere frame characterSkinPath = beginPath + movement + numberOfMovement + ".png"; // path premiere frame
/*A = new ArrayList<Double>(); /*A = new ArrayList<Double>();
n = 0;*/ n = 0;*/
try { try {
helpReader = new BufferedReader(new FileReader(source)); helpReader = new BufferedReader(new FileReader(source));
String line; String line;
...@@ -102,6 +112,7 @@ public class Jeu implements Game{ ...@@ -102,6 +112,7 @@ public class Jeu implements Game{
//faut supp la pour table obstacles //faut supp la pour table obstacles
obstacleTable.add(sol); obstacleTable.add(sol);
obstacleTable.add(new Obstacle(new HitBox(new Coordonnees(300,550),32,128))); obstacleTable.add(new Obstacle(new HitBox(new Coordonnees(300,550),32,128)));
obstacleTable.add(new Obstacle(new HitBox(new Coordonnees(800, 625),150,50))); obstacleTable.add(new Obstacle(new HitBox(new Coordonnees(800, 625),150,50)));
obstacleTable.add(new Obstacle(new HitBox(new Coordonnees(600, 662.5),75,50))); obstacleTable.add(new Obstacle(new HitBox(new Coordonnees(600, 662.5),75,50)));
......
...@@ -17,22 +17,26 @@ import java.net.URL; ...@@ -17,22 +17,26 @@ import java.net.URL;
import static environnement.HitBox.collision; import static environnement.HitBox.collision;
import static jeu.Jeu.*; import static jeu.Jeu.*;
import map.LevelManager;
public class Painter implements GamePainter{ public class Painter implements GamePainter{
protected static final int WIDTH = 1500; //protected static final int WIDTH = TILES_SIZE*TILES_IN_WIDTH;
protected static final int HEIGHT = 1000; //protected static final int HEIGHT = TILES_SIZE*TILES_IN_HEIGHT;
protected static final int WIDTH =1500;
protected static final int HEIGHT=1000;
private LevelManager levelManager;
public static Obstacle test = new Obstacle(new HitBox(new Coordonnees(300,550),32,128)); public static Obstacle test = new Obstacle(new HitBox(new Coordonnees(300,550),32,128));
private static Coordonnees coordonneesCam; private static Coordonnees coordonneesCam;
private int xCam; public int xCam;
private int zCam; public int zCam;
private int decalage = 225; private int decalage = 225;
private Painter painter;
public Painter() { public Painter() {
levelManager = new LevelManager(painter);
} }
@Override @Override
...@@ -43,14 +47,18 @@ public class Painter implements GamePainter{ ...@@ -43,14 +47,18 @@ public class Painter implements GamePainter{
Graphics2D crayon = (Graphics2D) im.getGraphics(); Graphics2D crayon = (Graphics2D) im.getGraphics();
crayon.setColor(Color.blue); crayon.setColor(Color.blue);
drawCharacter(crayon,gameCharacterLoader.getImageCharacter());
levelManager.draw();
drawMap(crayon); drawMap(crayon);
drawSol(crayon); drawSol(crayon);
drawObstacleBis(crayon,test,"plateforme.png"); // A changer drawObstacleBis(crayon,test,"plateforme.png"); // A changer
drawLifePoints(crayon); drawLifePoints(crayon);
drawMonsters(crayon); drawMonsters(crayon);
drawKunais(crayon); drawKunais(crayon);
drawCharacter(crayon,gameCharacterLoader.getImageCharacter());
} }
...@@ -120,6 +128,7 @@ public class Painter implements GamePainter{ ...@@ -120,6 +128,7 @@ public class Painter implements GamePainter{
} }
private void drawMap(Graphics2D crayon){ private void drawMap(Graphics2D crayon){
System.out.println("Nombre obstacle :"+Jeu.getObstacleTable().size());
for (Obstacle obs : Jeu.getObstacleTable()){ for (Obstacle obs : Jeu.getObstacleTable()){
if (!collision(gameCharacter.getHitBox(), obs.getHitbox())){ if (!collision(gameCharacter.getHitBox(), obs.getHitbox())){
crayon.setColor(Color.blue); crayon.setColor(Color.blue);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment