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

c bon LM

parent 04116312
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
......
......@@ -247,7 +247,7 @@ public class Jeu implements Game{
}
public static Character getGameCharacter() {
return gameCharacter.clone();
return gameCharacter;
}
public static List<Monster> getMonsterList() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment