diff --git a/Projet/Projet.ino b/Projet/Projet.ino index a79c344..986c225 100644 --- a/Projet/Projet.ino +++ b/Projet/Projet.ino @@ -6,21 +6,18 @@ LIS3DHTR lis; unsigned int tabPiecesNov[5][2]={{170, 170}, {160, 105}, {100, 205}, {145, 120}, {130, 220}}, // tableau des pieces du mode novice tabPiecesCon[5][2]={{4, 100}, {2, 46}, {100, 80}, {45, 120}, {250, 120}}, // tableau des pieces du mode confirmé - tabPiecesExp[5][2]={{4, 138}, {2, 54}, {100, 69}, {45, 120}, {250, 120}}; // tableau des pieces du mode expert - + tabPiecesExp[5][2]={{4, 138}, {2, 54}, {100, 69}, {45, 120}, {250, 120}}, //tableau des pieces du mode expert + tabActuel[5][2]; //tableau du mode actuel const unsigned int xMax = 307, yMax = 226; unsigned int xBoule=xMax/2, yBoule=yMax/2; // position x et y de départ de la boule const unsigned int rayonBoule = 7, rayonPiece = 5; // rayon de la boule et des pieces const unsigned int vitesseBoule = 8; // vitesse de déplacement de la boule - -unsigned int mode = 0; +unsigned int mode = 2; int chrono = 30000, score = 0; -bool time, start = false; - - +bool start = false; void setup() { tft.begin(); @@ -72,8 +69,8 @@ void afficherPiece(unsigned int tab[5][2]) { } bool colisions(int xPiece, int yPiece) { - //distance = sqrt((xBoule - xPiece)^^2 + (yBoule - yPiece)^^2); - //if(distance == 0) return true; + int distance = sqrt((xBoule - xPiece)^2 + (yBoule - yPiece)^2); + if(distance <= rayonBoule+rayonPiece) return true; return false; } @@ -84,7 +81,6 @@ void Gyroscope() { if(yBoule>yMax || yBoule<(rayonBoule+40) || xBoule>xMax || xBoule