Skip to content
Snippets Groups Projects
Commit 3341130d authored by Louis's avatar Louis
Browse files

ptites modifs pour evolution du code sur ShootingCharacter LM

parent 3d13bea7
No related branches found
No related tags found
No related merge requests found
......@@ -14,14 +14,15 @@ public class Kunai {
private Coordonnees coord;
private final Coordonnees coordInit; //coordonnees initiales
private boolean disappear = false; //variable disant si le kunai doit disparaitre ou non
private static final int sideLength = 16;
private static final int height = 12;
private static final int width = 24;
public Kunai(int dir,int dmg,Coordonnees c){
coord = c;
coordInit = coord;
damage = dmg;
direction = dir;
hitBox = new HitBox(coord,sideLength,sideLength);
hitBox = new HitBox(coord,height,width);
}
public void deplacement(){ //deplacement du kunai
......@@ -30,7 +31,7 @@ public class Kunai {
}
public void updateHitBox(){ //on update la hitbox du kunai
hitBox = new HitBox(coord,sideLength,sideLength);
hitBox = new HitBox(coord,height,width);
}
public void dealsDamage(Entity entity){
......@@ -73,8 +74,12 @@ public class Kunai {
return hitBox;
}
public static int getSideLength() {
return sideLength;
public static int getHeight() {
return height;
}
public static int getWidth() {
return width;
}
......
......@@ -15,7 +15,7 @@ public class ShootingCharacter extends Character{
public void attaque(){
if (this.getTableCommande().get("CommandAttack") != 0 && hasAttacked == 0){ //on ajoute un kunai dans la liste
List<Kunai> temp = Jeu.getKunaiList();
Coordonnees coordKunai = new Coordonnees(coord.getX()+direction*Kunai.getSideLength()/2+direction*this.getEntityWIDTH()/2, coord.getZ());
Coordonnees coordKunai = new Coordonnees(coord.getX()+direction*Kunai.getWidth()/2+direction*this.getEntityWIDTH()/2, coord.getZ());
temp.add(new Kunai(direction, attackStat, coordKunai));
Jeu.setKunaiList(temp);
hasAttacked++;
......
......@@ -21,7 +21,7 @@ import static jeu.Jeu.*;
public class Painter implements GamePainter{
protected static final int WIDTH = 1000;
protected static final int WIDTH = 1500;
protected static final int HEIGHT = 1000;
public static Obstacle test = new Obstacle(new HitBox(new Coordonnees(300,550),32,128));
......@@ -182,7 +182,7 @@ public class Painter implements GamePainter{
x = (int)kunai.getCoord().getX();
z = (int)kunai.getCoord().getZ();
if (HitBox.collision(gameCharacter.getHitBox(),kunai.getHitBox()))crayon.setColor(Color.red);
crayon.fillRect(x-Kunai.getSideLength()/2 - xCam, z-Kunai.getSideLength()/2 - zCam, Kunai.getSideLength(), Kunai.getSideLength());
crayon.fillRect(x-Kunai.getWidth()/2 - xCam, z-Kunai.getHeight()/2 - zCam, Kunai.getWidth(), Kunai.getHeight());
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment