Séparation game.c

This commit is contained in:
2023-12-07 14:32:42 +01:00
parent be324de28e
commit 711ab48c32
15 changed files with 152 additions and 344 deletions

View File

@@ -0,0 +1,40 @@
#include <stdlib.h>
#include <graph.h>
#include "../fichier.h/pastille.h"
#include "../fichier.h/serpent.h"
#include "../fichier.h/pastille.h"
#define LARGEUR_FENETRE 1250
#define HAUTEUR_FENETRE 750
#define TAILLE_CELLULE 25
#define DELAI_MILLISECONDES 100
#define ESPACE_NOIR 100
void genererPomme() {
int pommex[5];
int pommey[5];
int i;
for (i = 0; i < 5; i++) {
pommex[i] = rand() % (LARGEUR_FENETRE / TAILLE_CELLULE) * TAILLE_CELLULE;
pommey[i] = rand() % (HAUTEUR_FENETRE / TAILLE_CELLULE) * TAILLE_CELLULE;
}
}
void dessinerPomme() {
int i;
int pommex[5];
int pommey[5];
ChoisirCouleurDessin(CouleurParComposante(255, 0, 0));
for (i = 0; i < 5; i++) {
RemplirRectangle(pommex[i], pommey[i], TAILLE_CELLULE, TAILLE_CELLULE);
}
}
int collisionAvecPomme() {
int i;
int pommex[5];
int pommey[5];
for (i = 0; i < 5; i++) {
return (serpent.corps[0].x == pommex[i] && serpent.corps[i].y == pommey[i]);
}
}