Skip to content
Snippets Groups Projects
Commit eaacfe7c authored by Azurlors's avatar Azurlors
Browse files

Raloum

parent 193b4269
No related branches found
No related tags found
No related merge requests found
...@@ -5,7 +5,7 @@ import java.util.HashMap; ...@@ -5,7 +5,7 @@ import java.util.HashMap;
public class HitBox { public class HitBox {
//private final Coordonnees centre; //private final Coordonnees centre;
private HashMap<String, Coordonnees> extremites = new HashMap<String,Coordonnees>(); private HashMap<String, Coordonnees> extremites = new HashMap<>();
private static double defaultUnit = 10; private static double defaultUnit = 10;
public HitBox(Coordonnees c){ public HitBox(Coordonnees c){
...@@ -36,4 +36,17 @@ public class HitBox { ...@@ -36,4 +36,17 @@ public class HitBox {
public HashMap<String, Coordonnees> getExtremites() { public HashMap<String, Coordonnees> getExtremites() {
return extremites; return extremites;
} }
public static Boolean collisionHaute(HitBox A, HitBox B){
return !(A.extremites.get("HautGauche").getX() >= B.extremites.get("HautDroite").getX());
}
public static Boolean collisionDroite(HitBox A, HitBox B){
return !(A.extremites.get("HautDroite").getX() <= B.extremites.get("HautGauche").getX());
}
public static Boolean collisionGauche(HitBox A, HitBox B){
return !(A.extremites.get("HautGauche").getZ() >= B.extremites.get("BasGauche").getZ());
}
public static Boolean collisionBas(HitBox A, HitBox B){
return !(A.extremites.get("BasGauche").getZ() <= B.extremites.get("HautGauche").getZ());
}
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment