#include #include #include "../Main/init.h" #include "../ListeC/Liste.h" int CheckCollision(struct entite enti1,int L1,int H1,struct entite enti2 ,int L2, int H2) { //CheckX int gauche1 = enti1.posx-L1; int droite1 = enti1.posx+L1; int gauche2 = enti2.posx-L2; int droite2 = enti2.posx+L2; int CheckX=0; if(gauche1 >= gauche2 && gauche1 <= droite2) { CheckX=1; } else if(droite1 >= gauche2 && droite1 <= droite2) { CheckX=1; } //CheckY int haut1 = enti1.posy-H1; int bas1 = enti1.posy+H1; int haut2 = enti2.posy-H2; int bas2 = enti2.posy+H2; int CheckY=0; if(haut1 >= bas2 && haut1 <= haut2) { CheckY=1; } else if(bas1 >= bas2 && bas1 <= haut2) { CheckY=1; } if(CheckX+CheckY==2){return 1;} return 0; }