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

Paufinage de la map et ajouts de sprites

parent a2c12cbc
No related branches found
No related tags found
No related merge requests found
Showing
with 61 additions and 21 deletions
......@@ -27,8 +27,8 @@ public class Bat extends Monster{
}
//oscillement selon x
if (coord.getX() < 0)direction = 1;
else if (coord.getX() >= 1000)direction = -1;
if (coordInit.getX()-coord.getX() >= 150)direction = 1;
else if (coordInit.getX()-coord.getX() <= -150)direction = -1;
//actualisation des coordonnees
double newX = coord.getX() + direction*vitesseMax*delta;
......
......@@ -31,8 +31,8 @@ public class Jeu implements Game{
//Coordonees de debut du personnage
static final double zdebut = 300;
static final double xdebut = 700;
static final double zdebut = 700;
static final double xdebut = 1400;
//perso
static Character gameCharacter;
......@@ -64,7 +64,7 @@ public class Jeu implements Game{
private static List<Hearth> hearthList = new ArrayList<>();
//le sol
public static Obstacle sol = new Obstacle(new HitBox(new Coordonnees(200,1064),1,1000000));
public static Obstacle sol = new Obstacle(new HitBox(new Coordonnees(200,1088),1,1000000));
public static List<Obstacle> obstacleTable = new ArrayList<>();
private static List<Monster> monsterList = new ArrayList<>();
......@@ -72,9 +72,9 @@ public class Jeu implements Game{
private static List<Coffre> coffreTable = new ArrayList<>();
public final static int TILES_DEFAULT_SIZE=32;
public final static float SCALE=1.75f;
public final static int TILES_IN_WIDTH = 60;
public final static int TILES_IN_HEIGHT = 20;
public final static float SCALE=1.0f;
public final static int TILES_IN_WIDTH = 132;
public final static int TILES_IN_HEIGHT = 42;
public final static int TILES_SIZE = (int) (TILES_DEFAULT_SIZE*SCALE);
private static final LevelManager levelManager = new LevelManager();
;
......
......@@ -13,9 +13,9 @@ public class LoadSave {
//Association des differents sprites des blocs
public static final String LEVEL_SPRITES = "Obstacles/Map_sprites.png";
public static final String LEVEL_SPRITES = "Obstacles/Sprites_map.png";
//Map composee de pixels
public static final String LEVEL_ONE = "Obstacles/level_one_monster.png";
public static final String LEVEL_ONE = "Obstacles/level_one_pixels.png";
public static BufferedImage GetSpriteAtlas(String fileName) {
BufferedImage img = null;
......@@ -60,19 +60,31 @@ public class LoadSave {
value = 5;
//Long bloc de 7 de longueur
if (91<=value && value <= 110)
value = 25;
value = 37;
//Espaces vides
if (111<=value && value <= 130)
value = 12;
value = 24;
//Coffres
if (131<=value && value <= 150)
value = 11;
value = 12;
//MOnstres à pied
if (151<=value && value <= 170)
value = 13;
value = 14;
//Bat
if (171<=value && value <= 190)
value = 14;
value = 15;
//Boss
if (191<=value && value <= 210)
value = 16;
//Porte du boss
if (211<=value && value <= 225)
value = 13;
//Terre horizontale de 7 de longueur
if (226<=value && value <= 235)
value = 46;
//Terre verticale de 6 de hauteur
if (236<=value && value <= 245)
value = 8;
//Liste des valeurs
lvlData[j][i] = value;
}
......
......@@ -6,6 +6,7 @@ import java.util.ArrayList;
import java.util.List;
import entity.Bat;
import entity.Boss;
import entity.Monster;
import environnement.Coordonnees;
import environnement.HitBox;
......@@ -27,7 +28,7 @@ public class LevelManager {
private BufferedImage[] importOutsideSprites() {
BufferedImage img = LoadSave.GetSpriteAtlas(LoadSave.LEVEL_SPRITES);
levelSprite = new BufferedImage[7];
levelSprite = new BufferedImage[10];
//Pour les sprites de chaque bloc
//longs blocs de 6 de hauteur
......@@ -43,7 +44,13 @@ public class LevelManager {
//Coffres
levelSprite[5] = img.getSubimage(3 * 32, 32, 32, 32);
//Long bloc de 7 de longueur
levelSprite[6] = img.getSubimage(32, 3 * 32, 224, 32);
levelSprite[6] = img.getSubimage(32, 4 * 32, 224, 32);
//Porte du boss
levelSprite[7] = img.getSubimage(4 * 32, 32, 32, 96);
//Terre verticale de 6 de hauteur
levelSprite[8] = img.getSubimage(8 * 32, 0, 32, 192);
//Terre horizontale de 7 de longueur
levelSprite[9] = img.getSubimage(32, 5 * 32, 224, 32);
/*for (int j = 0; j < 2; j++)
for (int i = 0; i < 9; i++) {
int index = j * 9 + i;
......@@ -87,8 +94,23 @@ public class LevelManager {
obstacleList.add(new Obstacle(new HitBox(new Coordonnees(Jeu.TILES_SIZE * i+3*Jeu.TILES_SIZE/2, Jeu.TILES_SIZE * j-Jeu.TILES_SIZE/2), 1*Jeu.TILES_SIZE, 3*Jeu.TILES_SIZE)));
obstacleImage.add(tabImages[4]);
}
//Porte du boss
if (index==13) {
obstacleList.add(new Obstacle(new HitBox(new Coordonnees(Jeu.TILES_SIZE * i+1*Jeu.TILES_SIZE/2, Jeu.TILES_SIZE * j-3*Jeu.TILES_SIZE/2), 3*Jeu.TILES_SIZE, 1*Jeu.TILES_SIZE)));
obstacleImage.add(tabImages[7]);
}
//Terre verticale de 6 de hauteur
if (index==8) {
obstacleList.add(new Obstacle(new HitBox(new Coordonnees(Jeu.TILES_SIZE * i+1*Jeu.TILES_SIZE/2, Jeu.TILES_SIZE * j-6*Jeu.TILES_SIZE/2), 6*Jeu.TILES_SIZE, 1*Jeu.TILES_SIZE)));
obstacleImage.add(tabImages[8]);
}
//Terre horizontale de 7 de longueur
if (index==46) {
obstacleList.add(new Obstacle(new HitBox(new Coordonnees(Jeu.TILES_SIZE * i+7*Jeu.TILES_SIZE/2, Jeu.TILES_SIZE * j-1*Jeu.TILES_SIZE/2), 1*Jeu.TILES_SIZE, 7*Jeu.TILES_SIZE)));
obstacleImage.add(tabImages[9]);
}
//Long bloc de 7 de longueur
if (index==25) {
if (index==37) {
obstacleList.add(new Obstacle(new HitBox(new Coordonnees(Jeu.TILES_SIZE * i+7*Jeu.TILES_SIZE/2, Jeu.TILES_SIZE * j-Jeu.TILES_SIZE/2), 1*Jeu.TILES_SIZE, 7*Jeu.TILES_SIZE)));
obstacleImage.add(tabImages[6]);
}
......@@ -103,13 +125,19 @@ public class LevelManager {
int index = levelOne.getSpriteIndex(i, j);
//Monstres à pied
if (index == 13) {
if (index == 14) {
monsterList.add(new Monster(new Coordonnees(32 * i + 30 / 2, 32 * j - 62 / 2), 1000, 30, 60, 1, 5));
}
//chauve-souris
if (index == 14) {
if (index == 15) {
monsterList.add(new Bat(new Coordonnees(32 * i + 20 / 2, 32 * j - 30 / 2), 1, 3));
System.out.println(32*i+10);
}
//Boss
if (index == 16) {
monsterList.add(new Boss(new Coordonnees(32*i, 32*j-96/2), 500, 90, 180, 3, 50));
}
}
......@@ -123,7 +151,7 @@ public class LevelManager {
for (int i = 0; i < Jeu.TILES_IN_WIDTH; i++) {
int index = levelOne.getSpriteIndex(i, j);
//Coffres
if (index==11) {
if (index==12) {
coffreListe.add(new Coffre(new HitBox(new Coordonnees(Jeu.TILES_SIZE * i+Jeu.TILES_SIZE/2, Jeu.TILES_SIZE * j-Jeu.TILES_SIZE/2), Jeu.TILES_SIZE, Jeu.TILES_SIZE)));
}
......
MAVENProject/src/main/resources/Monstres/boss_idle_L1.png

4.71 KiB

MAVENProject/src/main/resources/Monstres/boss_idle_L2.png

4.67 KiB

MAVENProject/src/main/resources/Monstres/boss_run_L1.png

4.83 KiB

MAVENProject/src/main/resources/Monstres/boss_run_L2.png

4.8 KiB

MAVENProject/src/main/resources/Obstacles/Sprites_map.png

55.3 KiB

MAVENProject/src/main/resources/Obstacles/level_one_monster.png

935 B | W: | H:

MAVENProject/src/main/resources/Obstacles/level_one_monster.png

950 B | W: | H:

MAVENProject/src/main/resources/Obstacles/level_one_monster.png
MAVENProject/src/main/resources/Obstacles/level_one_monster.png
MAVENProject/src/main/resources/Obstacles/level_one_monster.png
MAVENProject/src/main/resources/Obstacles/level_one_monster.png
  • 2-up
  • Swipe
  • Onion skin
MAVENProject/src/main/resources/Obstacles/level_one_pixels.png

5.73 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment