Skip to content
Snippets Groups Projects
Commit 41aebf68 authored by Louis MALTERRE's avatar Louis MALTERRE
Browse files

ptit bugs sur l anim du boss, si vous trouvez j suis preneur LM

parent 282e3cab
No related branches found
No related tags found
No related merge requests found
package entity;
import environnement.Coordonnees;
//import environnement.Physique;
import environnement.Physique;
import environnement.PositionCollision;
import static environnement.PositionCollision.*;
......@@ -9,15 +9,19 @@ import map.Obstacle;
import static jeu.Jeu.getObstacleTable;
import java.util.FormatterClosedException;
import java.util.HashMap;
import java.util.List;
public class Boss extends Monster{
private int impulsionSaut = 0;
private String move = "_run";
private String lastMove = move;
public Boss(Coordonnees c, double vitesseMax,double width,double height,int atkStt,int nbLP){
super(c, vitesseMax, width, height, atkStt, nbLP);
monsterType = "boss";
}
public void deplacements(){
......@@ -45,10 +49,6 @@ public class Boss extends Monster{
vitesseActuZ = vitesseActuZ - 8*impulsionSaut*delta;
}
setCoord(new Coordonnees(newX, newZ));
}
......@@ -85,18 +85,6 @@ public class Boss extends Monster{
break;
}
}
/*for (Obstacle obs : listeObstaclesInVoisinage){ //on cherche l'obstacle en-dessous du perso
if (obs.getHitbox().getExtremites().get("HautGauche").getZ() <= obstacleBeneath.getHitbox().getExtremites().get("HautGauche").getZ() && obs.getHitbox().getExtremites().get("HautGauche").getZ() >= hitBox.getExtremites().get("BasDroite").getZ()){
obstacleBeneath = obs;
}
}
if (collisionsPresentes.get(obstacleBeneath) == BAS && tableCommande.get("CommandAttack") == 0){
this.vitesseActuZ = 0;
this.setCoord(new Coordonnees(this.getCoord().getX(), obstacleBeneath.getHitbox().getExtremites().get("HautGauche").getZ()-entityHEIGHT/2-1));
alpha = 1;
onGround = true;
}*/
//}
......@@ -125,9 +113,43 @@ public class Boss extends Monster{
}
}
private void updateSprite(){
lastMove = move;
String dir = "_L";
if (isAttacking >= 1 && isAttacking <=200){
move = "_attack";
}
else if (alpha == 0){
move = "_jump";
}
else {
move = "_run";
}
if (move != lastMove){
nbBeforeFrameChange = 0;
nbFrame = 1;
}
else{
if (nbBeforeFrameChange == 0)nbFrame = nbFrame%2+1;
}
if (nbBeforeFrameChange == 0){
setSprite(beginPath + monsterType + move + dir + nbFrame + ".png");
nbBeforeFrameChange = 100;
}
else {
nbBeforeFrameChange--;
}
System.out.println(beginPath + monsterType + move + dir + nbFrame + ".png");
}
public void evolveMonster(){
super.evolveMonster();
impulsionSaut = 0;
updateSprite();
}
}
......@@ -203,6 +203,10 @@ public class Monster extends Entity{
public String getSprite() {
return sprite;
}
void setSprite(String sprite) {
this.sprite = sprite;
}
}
......@@ -99,7 +99,16 @@ public class Painter implements GamePainter{
Coordonnees bd = extremites.get("BasDroite");
Coordonnees hg = extremites.get("HautGauche");
Coordonnees bg = extremites.get("BasGauche");
crayon.fillRect((int)hg.getX()-xCam, (int)hg.getZ()-zCam, hearth.getWidth(), hearth.getHeight());
//crayon.fillRect((int)hg.getX()-xCam, (int)hg.getZ()-zCam, hearth.getWidth(), hearth.getHeight());
//on dessine les coeurs drop
//cest la pour les sprites, remplacer Jeu.class par classedanslaquelletues.class
String fn = "Monstres";
URL url = Jeu.class.getClassLoader().getResource(fn);
assert url != null;
String beginPath = url.toString().substring(6)+"/";
//************************* */
crayon.drawImage(new ImageIcon(beginPath+"heart.png").getImage(), (int)hd.getX()-xCam-20, (int)hd.getZ()-zCam, null,null);
}
}
......@@ -196,7 +205,7 @@ public class Painter implements GamePainter{
//crayon.drawRect(x-300 - xCam, z-300 - zCam, 600, 600);
if (HitBox.collision(gameCharacter.getHitBox(),monster.getHitBox()))crayon.setColor(Color.red);
if (monster.getNbFramesInvincible() > 0)crayon.setColor(Color.black);
//crayon.fillRect(x-(int)monster.getEntityWIDTH()/2 - xCam, z-(int)monster.getEntityHEIGHT()/2 - zCam, (int)monster.getEntityWIDTH(), (int)monster.getEntityHEIGHT());
crayon.fillRect(x-(int)monster.getEntityWIDTH()/2 - xCam, z-(int)monster.getEntityHEIGHT()/2 - zCam, (int)monster.getEntityWIDTH(), (int)monster.getEntityHEIGHT());
if (monster instanceof Bat){
crayon.drawImage(new ImageIcon(monster.getSprite()).getImage(),x-(int)monster.getEntityWIDTH()/2 - xCam-7,z-(int)monster.getEntityHEIGHT()/2 - zCam-3, null);
}
......
MAVENProject/src/main/resources/Monstres/boss_attack_L2.png

5.56 KiB

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

5.12 KiB

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