From 0476206bbd1b089bd5dd71d39d3b614ee2c74e76 Mon Sep 17 00:00:00 2001 From: Louis MALTERRE <malterre.louis@laposte.net> Date: Fri, 16 Dec 2022 16:24:05 +0100 Subject: [PATCH] c bon LM --- .../src/main/java/entity/Character.java | 21 +++++++++---------- MAVENProject/src/main/java/jeu/Jeu.java | 2 +- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/MAVENProject/src/main/java/entity/Character.java b/MAVENProject/src/main/java/entity/Character.java index 311acb1..d9ead68 100644 --- a/MAVENProject/src/main/java/entity/Character.java +++ b/MAVENProject/src/main/java/entity/Character.java @@ -28,7 +28,7 @@ public class Character extends Entity{ private double masse; public int key; - private Map<String,Double> tableCommande; //table des commandes du perso + protected Map<String,Double> tableCommande; //table des commandes du perso //private Obstacle obstacleBeneath = Jeu.sol; @@ -45,7 +45,7 @@ public class Character extends Entity{ nbMaxFramesInvicible = 500; } - private void deplacements(){ // alpha indique si il est au sol ou non, il vaut 0 (en l'air) ou 1 (au sol) en fonction + void deplacements(){ // alpha indique si il est au sol ou non, il vaut 0 (en l'air) ou 1 (au sol) en fonction double delta = Math.pow(10, -3); // pas de temps remis en secondes @@ -72,7 +72,7 @@ public class Character extends Entity{ if (Math.abs(vitesseActuZ) > vitesseMax*500)vitesseActuZ = Math.signum(vitesseActuZ)*vitesseMax*500; } - private void collisionGestion(){ + void collisionGestion(){ List<Obstacle> listeObstaclesInVoisinage = getObstacleTable(); //stocke l'obstacle avec lequel il y a eu collision HashMap<Obstacle,PositionCollision> collisionsPresentes = new HashMap<Obstacle,PositionCollision>(); @@ -144,7 +144,7 @@ public class Character extends Entity{ } } - private void keyGestion() { + void keyGestion() { for (Coffre cof : Jeu.getCoffreTable()){ if (HitBox.collision(this.getHitBox(), cof.getHitbox())){ if (cof.key) { @@ -156,7 +156,7 @@ public class Character extends Entity{ } } - private List<Obstacle> obstacleInVoisinage(){ //recupere la liste des obstacles presents dans le voisinage + List<Obstacle> obstacleInVoisinage(){ //recupere la liste des obstacles presents dans le voisinage List<Obstacle> liste = new ArrayList<>(); for (Obstacle obs : getObstacleTable()){ if (HitBox.collision(voisinage, obs.getHitbox())){ @@ -167,7 +167,7 @@ public class Character extends Entity{ } - private void attaque(){ + void attaque(){ Coordonnees attackCenter = new Coordonnees(coord.getX() + direction*entityWIDTH/2, coord.getZ()); Attack characterAttack = new Attack(attackStat, attackCenter, new HitBox(attackCenter,entityHEIGHT,entityWIDTH+20)); for (Monster monster : Jeu.getMonsterList()){ @@ -179,7 +179,7 @@ public class Character extends Entity{ } - private void getGameCommand(){ + void getGameCommand(){ Map<String,Boolean> commandeJeu = Jeu.getDirectionJeu(); if (commandeJeu.get("Right") && commandeJeu.get("Left")){tableCommande.replace("CommandX", (double)0);} @@ -197,7 +197,7 @@ public class Character extends Entity{ if (commandeJeu.get("Attack"))tableCommande.replace("CommandAttack", (double)1); } - private void resetCommand(){ + void resetCommand(){ for (String key : tableCommande.keySet()){ tableCommande.replace(key, (double)0); } @@ -207,7 +207,6 @@ public class Character extends Entity{ getGameCommand(); deplacements(); collisionGestion(); - //System.out.println(obstacleBeneath); keyGestion(); updateVoisinage(); this.setHitBox(new HitBox(this.getCoord(),entityHEIGHT,entityWIDTH)); // mise à jour moins crade pour l'instant @@ -218,7 +217,7 @@ public class Character extends Entity{ } - private void updateNbFrameInvincible(){ + void updateNbFrameInvincible(){ nbFramesInvincible = Math.max(0, nbFramesInvincible-1); } @@ -238,7 +237,7 @@ public class Character extends Entity{ return impulsionSaut; } - private void updateVoisinage(){ + protected void updateVoisinage(){ voisinage = new HitBox(coord, 1000, 1000); } diff --git a/MAVENProject/src/main/java/jeu/Jeu.java b/MAVENProject/src/main/java/jeu/Jeu.java index 37b2d01..c5625cd 100644 --- a/MAVENProject/src/main/java/jeu/Jeu.java +++ b/MAVENProject/src/main/java/jeu/Jeu.java @@ -247,7 +247,7 @@ public class Jeu implements Game{ } public static Character getGameCharacter() { - return gameCharacter.clone(); + return gameCharacter; } public static List<Monster> getMonsterList() { -- GitLab