#include #include #include "../Graphique/libgraph.h" #include "../ListeC/Liste.h" #include "Monstre.h" #define TailleX 500 #define TailleY 500 #define ErreurHitbox 2 //Sens = 1 -> Va vers la droite void DeplacementSbire(struct liste_entite* Liste, int* SensDeplacement, int Vitesse) { int ind = 0; struct liste_entite* pListe = Liste; while (pListe != NULL) { pListe->entite.posx += (*SensDeplacement == 1) ? Vitesse : -Vitesse; if (pListe->entite.posx >= 9 * TailleX / 10) ind = 1; else if (pListe->entite.posx <= TailleX / 10) ind = 2; pListe = pListe->suivant; } if (ind != 0) { *SensDeplacement = (ind == 1) ? 0 : 1; struct liste_entite* p2Liste = Liste; while (p2Liste != NULL) { p2Liste->entite.posy += 30; p2Liste = p2Liste->suivant; } } } void LigneSbire (struct liste_entite** ListeSbire, int nbr_enemies, int nbr_rangee) { for (int j = 1; j <= nbr_rangee; j++) { int compteurY = j * TailleY / 10; int compteurX = TailleX / nbr_enemies; for (int i = 0; i < nbr_enemies; i++) { if (j == nbr_rangee) { ajout_tete(ListeSbire, creer_entite(compteurX, compteurY, 1) ); compteurX += 2 * TailleX / (3 * nbr_enemies); } else { ajout_tete(ListeSbire, creer_entite(compteurX, compteurY, 0) ); compteurX += 2 * TailleX / (3 * nbr_enemies); } } } } void AfficherSbire (struct liste_entite* Liste, int lutin, int Largeur, int Hauteur) { struct liste_entite* pListe = Liste; while (pListe != NULL) { afficherLutin(lutin, pListe->entite.posx - Largeur / 2 + ErreurHitbox, pListe->entite.posy - Hauteur / 2 + ErreurHitbox); pListe=pListe->suivant; } }