Skip to content
Snippets Groups Projects
Commit f651d446 authored by bruno's avatar bruno
Browse files

key

parent 5dfb878e
No related branches found
No related tags found
1 merge request!1Key
......@@ -13,9 +13,13 @@ import static environnement.PositionCollision.*;
import environnement.PositionCollision;
import jeu.Jeu;
import map.Obstacle;
import map.Coffre;
import static environnement.HitBox.collision;
import static environnement.HitBox.collisionObstacle;
import static jeu.Jeu.getObstacleTable;
//import static jeu.Jeu.gameCharacter;
import static jeu.Jeu.getCoffreTable;
public class Character extends Entity{
......@@ -23,7 +27,7 @@ public class Character extends Entity{
private double vitesseActuZ = 0;
private final double impulsionSaut;
private double masse;
private int clef;
public int key;
private Map<String,Double> tableCommande; //table des commandes du perso
......@@ -112,7 +116,20 @@ public class Character extends Entity{
}
}
}
public void keyGestion() {
for (Coffre obs : Jeu.getCoffreTable()){
if (collision(this.getHitBox(), obs.getHitbox())){
if (obs.key ==true) {
this.key += 1;
obs.key = false;
System.out.print(this.key);
}
}
}
}
public List<Obstacle> obstacleInVoisinage(){
List<Obstacle> liste = new ArrayList<>();
for (Obstacle obs : getObstacleTable()){
......@@ -133,14 +150,6 @@ public class Character extends Entity{
}
}
public void clef(){
for (Coffre coffre : Jeu.getCoffreTable()){
if (HitBox.collision(this.hitBox, coffre.getHitBox()){
monster.setNbLifePoints(Math.max(monster.getNbLifePoints()-attackStat,0));
}
}
}
public void getGameCommand(){
Map<String,Boolean> commandeJeu = Jeu.getDirectionJeu();
......@@ -171,6 +180,7 @@ public class Character extends Entity{
deplacements();
attaque();
collisionGestion();
keyGestion();
updateVoisinage();
this.setHitBox(new HitBox(this.getCoord(),entityHEIGHT,entityWIDTH)); // mise à jour moins crade pour l'instant
resetCommand();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment