Skip to content
Snippets Groups Projects
Commit 85a3f7cf authored by LACOTE Bruno's avatar LACOTE Bruno
Browse files

Merge branch 'key' into 'main'

Key

See merge request !1
parents 2ff16f2f 2e4cb83c
No related branches found
No related tags found
1 merge request!1Key
......@@ -13,9 +13,12 @@ import static environnement.PositionCollision.*;
import environnement.PositionCollision;
import jeu.Jeu;
import map.Obstacle;
import map.Coffre;
import static jeu.Jeu.getObstacleTable;
//import static jeu.Jeu.gameCharacter;
import static jeu.Jeu.getCoffreTable;
public class Character extends Entity{
......@@ -23,7 +26,8 @@ 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
private Obstacle obstacleBeneath = Jeu.sol;
......@@ -126,6 +130,18 @@ public class Character extends Entity{
}
}
}
public void keyGestion() {
for (Coffre cof : Jeu.getCoffreTable()){
if (collision(this.getHitBox(), cof.getHitbox())){
if (cof.key ==true) {
this.key += 1;
cof.key = false;
System.out.print("Tu as trouvé une clée!");
}
}
}
}
public List<Obstacle> obstacleInVoisinage(){ //recupere la liste des obstacles presents dans le voisinage
List<Obstacle> liste = new ArrayList<>();
......
......@@ -52,6 +52,7 @@ public class Painter implements GamePainter{
drawSol(crayon);
//drawObstacleBis(crayon,test,"plateforme.png"); // A changer
drawLifePoints(crayon);
drawKey(crayon);
drawMonsters(crayon);
drawKunais(crayon);
......@@ -71,6 +72,12 @@ public class Painter implements GamePainter{
}
}
private void drawKey(Graphics2D crayon){
if(gameCharacter.key==0) {
crayon.fillRect(-10,20,-20,30);
}
}
private void drawLifePoints(Graphics2D crayon){
String fn = "Frames_perso";
URL url = Jeu.class.getClassLoader().getResource(fn);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment