示例#1
0
/**
 * \fn void actio(t_perso *perso)
 * \param perso Personnage du tableau de perso 
 * \brief Effectue une action pour un personnage 
 *
 */
void actio(t_perso *perso){
	if(perso->i_HP > 0){

		int PA_actuel = perso->i_PA, PM_actuel = perso->i_PM; /*Permet de ne pas modifier les statistiques du personnage*/
		do{
			afficher_map();
			affichage_perso(*perso);
			printf("%i PA, %i PM\n", PA_actuel, PM_actuel);
			printf("1 - Deplacement\n");
			printf("2 - Attaque\n");
			printf("3 - Passer\n");
			printf("4 - Sauvegarder\n");
			printf("5 - Menu Principal\n");
			scanf("%i", &action);
			switch(action){
				case 1:	deplacement(&PM_actuel);
					break;
				case 2: attaque(&PA_actuel);
					break;
				case 3: printf("Passage de tour\n");
					break;
				case 4: save();
					break;
				case 5: break;
			}
			perso_vivant();
		}while(action != 3 && action != 5 && !victoire());
	}
}
示例#2
0
void CameraFPS::onEvent(Input const& input)
{
  //évênements souris
  if(input.mouseMove())
    orienter(input.getXRel(), input.getYRel());//changement d'orientation
  //évênements claviers
  glm::vec3 deplacement(0.0f,0.0f,0.0f);
  float zoom = 0.0f;
  if(input.getKey(SDL_SCANCODE_W))//Z pour un clavier francophone
    deplacement += m_vitesse * m_orientation;
  if(input.getKey(SDL_SCANCODE_S))
    deplacement -= m_vitesse * m_orientation;
  if(input.getKey(SDL_SCANCODE_A))//Q pour un clavier francophone
    deplacement += m_vitesse * m_droite;
  if(input.getKey(SDL_SCANCODE_D))
    deplacement -= m_vitesse * m_droite;
  if(input.getKey(SDL_SCANCODE_KP_PLUS)) // touche + du pavé numérique pour zoomer
    zoom -= 1.0f;
  if(input.getKey(SDL_SCANCODE_KP_MINUS)) // touche - du pavé numérique pour dezoomer
    zoom += 1.0f;
  if(zoom!=0.0f)
    zoomer(zoom);
  if(deplacement != glm::vec3(0.0f,0.0f,0.0f))
    deplacer(deplacement); // déplacement de la camera
  m_cible = m_position + m_orientation;
  if(deplacement != glm::vec3(0.0f,0.0f,0.0f) || input.mouseMove())
    lookAt();
}
示例#3
0
int    mouvement(char *direction, char carte[20][20], int *x, int *y) {
    int result;

    result = 1;
    if (*direction == 'd')
        result = deplacement(carte, x, y, 0, 1);
    else if (*direction == 'w' || *direction == 'z')
        result = deplacement(carte, x, y, -1, 0);
    else if (*direction == 's')
        result = deplacement(carte, x, y, 1, 0);
    else if (*direction == 'a' || *direction == 'q')
        result = deplacement(carte, x, y, 0, -1);
    else if (*direction == 'e')
        return (-1);
    *direction = ' ';
    return (result);
}
示例#4
0
文件: grille.cpp 项目: gndu91/2048
bool estTerminer(Grille grille) {/**
    for(unsigned int y = 0; y < grille.size(); ++y)
        for(unsigned int x = 0; x < grille.at(y).size(); ++x)
            if(grille[y][x] == 0)
                return false;
    for(unsigned int y = 0; y < grille.size() - 1; ++y)
        for(unsigned int x = 1; x < grille.at(y).size()- 1; ++x)
            if(grille[y][x] == grille[y+1][x]
            or grille[y][x] == grille[y][x+1])
                return false;
    return true;
    */
    if(grille == deplacement(grille,HAUT))
        if(grille == deplacement(grille,BAS))
            if(grille == deplacement(grille,DROITE))
                if(grille == deplacement(grille,GAUCHE))
                   return true;
    return false;
}
示例#5
0
void Monde::actions()
{
    init_pair(1, COLOR_RED, COLOR_RED);
    init_pair(2, COLOR_GREEN, COLOR_GREEN);
    init_pair(3, COLOR_YELLOW, COLOR_YELLOW);
    switch(tolower(getch()))
    {
    case 'z':
            deplacement(-1,0);
            break;
    case 's':
            deplacement(+1,0);
        break;
    case 'q':
            deplacement(0,-1);
        break;
    case 'd':
            deplacement(0,+1);
    }
}
示例#6
0
文件: jeu.cpp 项目: gndu91/2048plus
void jeu(void) {
    Grille g = grilleVide();
    while(not estTerminer(g)) {
        system("cls");
        g = addNumber(g);
        cout    << "Your current score is: " << score(g)                    << endl
                << "Here is the grill: "                                    << endl;
        afficheGrille(g);
        cout                                                                << endl
                << "\t" << "What is your next move (use zqsd, not ZQSD)"    << endl
                << "\t" << "\t" << "Your choice:";
        g = deplacement(g);
        ///while(g == deplacement(g) and false);
    }
}
示例#7
0
void Unite::deplacer(Case c) {
    Case nouveau = deplacement(c);
    if (c.getX()!=nouveau.getX() && c.getY()!=nouveau.getY() && !nouveau.isOccupee())
    {
        nouveau.setCase(this);
        //Rajout de void setCase(Unite unite); -> Test de si la case n'est pas occup�, puis mettre a jour la case
                                // appel d'une exception si la case est occup� (Pour saut� l'instruction suivante)
                                // ou avec un booleen, je ne sais pas
                                // Nicolas :-D
        c.setCase(NULL);
        // mettre a 0 la case
    }
    else
    {
        cout << "case prise"<<endl;
    }
}
示例#8
0
文件: Tapis.cpp 项目: padenot/usdp
void Tapis::deroulerTapis(double dt)
{
    QVector2D deplacement(_tronconSupport->position() - _position);
    deplacement.normalize();
    deplacement *= _vitesse*dt;

    // Pour chaque bagage sur le tapis
    for (QVector<Bagage*>::iterator it = _bagages.begin() ;
        it != _bagages.end() && _chariotConnecte != 0;
        ++it)
    {
        (*it)->simulerDeplacement(deplacement);

        if(bagageEstSorti(*it))
        {
            _chariotConnecte->chargerBagage(*it);
            _bagages.erase(it);
            deconnecter();
        }
    }
}
////////////////////////////////////////////////////////////////////////
///
/// @fn void NodeTableControlPoint::move3DModel( const Vecteur3& targetPosition )
///
/// /*Description*/
///
/// @param[in] const Vecteur3 & targetPosition
///
/// @return void
///
////////////////////////////////////////////////////////////////////////
void NodeTableControlPoint::move3DModel( const Vecteur3& targetPosition )
{
#if WIN32  
    // onlny edit model if the table is present
    auto field = getField();
    if( field && field->getTable() && !field->getIsSimulation() && field->getResizeTableModel())
    {
        const GroupeTripleAdresseFloat* liste = obtenirListePointsAChanger();
        Vecteur3 deplacement(targetPosition-mPosition);
        if(liste)
        {
            for(unsigned int i=0; i<liste->size(); i++)
            {
                *(liste->get(i)[VX]) += (float)deplacement[VX];
                *(liste->get(i)[VY]) += (float)deplacement[VY];
            }
        }
        else
        {
            NoeudTable::queueTableModelMove(typePosNoeud_,deplacement);
        }
    }
#endif
}
示例#10
0
void jouer (SDL_Surface* ecran, struct options options, int *enpause, int vload)
{

printf ("Debut de la fonction jouer \n");

// Declaration de variable

int plateau[8][8] = {0};
int deco[8][8][2] = {0};
int continuer = 0;
int selection = 0; // 1 : Une piece est selectionnée // 0 : Non
int libre = 0;
int echec = 0;
int i = 0;
int j = 0;
int tour = 0;
int lasttour = 0 ;
int starttime = 0 ;
struct coordonees casedepart = {0, 0};
struct coordonees casearrivee = {0, 0};
struct coordonees positionroi = {0, 0};
struct roque roque = {1, 1, 1, 0, 0};

SDL_Event event;

// Fin de la declaration de variables

// Initialisation

continuer = 1; 

if (vload == 0)
{
	plateau[0][0] = 10; 
	plateau[1][0] = 9;
	plateau[2][0] = 8;
	plateau[3][0] = 12;
	plateau[4][0] = 11;
	plateau[5][0] = 8; 
	plateau[6][0] = 9;
	plateau[7][0] = 10;

	plateau[0][1] = 7; 
	plateau[1][1] = 7;
	plateau[2][1] = 7;
	plateau[3][1] = 7;
	plateau[4][1] = 7;
	plateau[5][1] = 7; 
	plateau[6][1] = 7;
	plateau[7][1] = 7;

	plateau[0][6] = 1; 
	plateau[1][6] = 1;
	plateau[2][6] = 1;
	plateau[3][6] = 1;
	plateau[4][6] = 1;
	plateau[5][6] = 1; 
	plateau[6][6] = 1;
	plateau[7][6] = 1;

	plateau[0][7] = 4; 
	plateau[1][7] = 3;
	plateau[2][7] = 2;
	plateau[3][7] = 5;
	plateau[4][7] = 6;
	plateau[5][7] = 2; 
	plateau[6][7] = 3;
	plateau[7][7] = 4;
	
	archivage (&casedepart, &casearrivee, 1, &starttime, tour) ; // Ecriture de l'en-tete
}
else if (vload == 1)
{
	load (plateau) ;
}

affichage(ecran, plateau, deco, options);

for ( i = 0 ; i < 8 ; i ++ )
{
for ( j = 0 ; j < 8 ; j ++ )
{
	if ( plateau[i][j] == 6 )
	{
		positionroi.x = i;
		positionroi.y = j;
	}
}
}

// Fin d'initialisation

	while (continuer)
	{

		SDL_WaitEvent(&event); /* Récupèration de l'évènement dans event */
		switch(event.type) /* Test du type d'évènement */
		{
			case SDL_QUIT: /* Si c'est un évènement de type "Quitter" */
				continuer = 0;
			break;
			case SDL_KEYDOWN:
				switch(event.key.keysym.sym)
				{
					case SDLK_ESCAPE: // ECHAP
						save (plateau);
						*enpause = 1;
						continuer = 0;
					break;
				}
			break;
			case SDL_MOUSEBUTTONUP:
			  
			  
				if ( tour != lasttour ) // Si on a changé de tour
				{
				printf(" \n\n////// TOUR %d //////\n", tour);
				}
				lasttour = tour ;
				
				if (options.o2 > 1){printf(" Clic en x= %d // y = %d \n", event.button.x, event.button.y);}
				
				deplacement (event, ecran, &casedepart, &casearrivee, plateau, deco, &selection, &positionroi, &echec, &tour, &roque, &starttime);
				
				affichage(ecran, plateau, deco, options, roque);
			break;
		
	    	}
	}
	
printf ("Fin de la fonction jouer \n");

} // Fin de la fonction jouer
int main()
{
  char filename[106] = "data/grille.txt";
	char buffer[500];
	char buffer2[300];

    SDL_Surface *screen, *temp, *sprite, *backbg, *monster, *wall, *trap, *life, *sword, *armor, *door, *text, *defatt;
	SDL_Rect rcSprite, rcGrass, rcMonster, rcWall, rcTrap, rcLife, rcSword, rcArmor, rcDoor, rcText, rcDefatt;
	SDL_Event event;
	TTF_Font *font;
	SDL_Color white = {255, 255, 255};
	Uint8 *keystate;
	int colorkey, gameover = 0;

	SDL_Init(SDL_INIT_VIDEO);
	TTF_Init();

	SDL_WM_SetCaption("Lab", "Lab");

	screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);

	colorkey = SDL_MapRGB(screen->format, 255, 0, 255);

	temp   = IMG_Load("data/perso.bmp");
	sprite = SDL_DisplayFormat(temp);

	SDL_SetColorKey(sprite, SDL_SRCCOLORKEY | SDL_RLEACCEL, colorkey);


	temp   = IMG_Load("data/monstre.bmp");
	monster = SDL_DisplayFormat(temp);

	SDL_SetColorKey(monster, SDL_SRCCOLORKEY | SDL_RLEACCEL, colorkey);


	font = TTF_OpenFont("data/a.ttf", 14);

	temp  = SDL_LoadBMP("data/sol.bmp");
	backbg = SDL_DisplayFormat(temp);


	temp  = SDL_LoadBMP("data/mur.bmp");
	wall = SDL_DisplayFormat(temp);


    temp  = SDL_LoadBMP("data/piege.bmp");
	trap = SDL_DisplayFormat(temp);


	temp  = SDL_LoadBMP("data/potion.bmp");
	life = SDL_DisplayFormat(temp);

	SDL_SetColorKey(life, SDL_SRCCOLORKEY | SDL_RLEACCEL, colorkey);


	temp  = SDL_LoadBMP("data/epee.bmp");
	sword = SDL_DisplayFormat(temp);

	SDL_SetColorKey(sword, SDL_SRCCOLORKEY | SDL_RLEACCEL, colorkey);


	temp  = SDL_LoadBMP("data/armure.bmp");
	armor = SDL_DisplayFormat(temp);

	SDL_SetColorKey(armor, SDL_SRCCOLORKEY | SDL_RLEACCEL, colorkey);


	temp  = SDL_LoadBMP("data/porte.bmp");
	door = SDL_DisplayFormat(temp);


    joueur * j = alloue_joueur();
    grille * g = creer_grille(filename, j);
    monstre * m = creer_monstre(g);

	rcSprite.x = j->x*SPRITE_SIZE;
	rcSprite.y = j->y*SPRITE_SIZE;

	rcMonster.x = m->x*SPRITE_SIZE;
	rcMonster.y = m->y*SPRITE_SIZE;

	rcText.x = 32;
	rcText.y = SCREEN_HEIGHT - 32;

	rcDefatt.x = 32;
	rcDefatt.y = SCREEN_HEIGHT - 16;

    while ((gameover != 1))
    {

	 if (SDL_PollEvent(&event))
	 {
		switch (event.type)
		{
			case SDL_QUIT:
				gameover = 1;
            break;

			case SDL_KEYDOWN:
				switch (event.key.keysym.sym)
				{
					case SDLK_ESCAPE:
                        gameover = 1;
					case SDLK_q:
						gameover = 1;
						break;
                    default:
                        break;
				}
            break;
		}




        keystate = SDL_GetKeyState(NULL);
		if ((keystate[SDLK_LEFT]) && (gameover != 2) ) {
		    deplacement(g,j,113);

			sprintf(buffer, "Remaining lives: %d", j->vie);
			text = TTF_RenderText_Solid(font, buffer, white);

			if (g->content[j->y][j->x] == 8)
            {
                sprintf(buffer, "You won! Press Q or ESC to quit");
                text = TTF_RenderText_Solid(font, buffer, white);
				gameover = 2;
            }
		    if (m -> vie > 0)
                deplacement_monstre(g, j, m);
            if (j->vie <=0 )
            {
                sprintf(buffer, "You lost! Press Q or ESC to quit");
                text = TTF_RenderText_Solid(font, buffer, white);
                gameover = 2;
            }
			rcSprite.x = (j->x)*STEP_SIZE;
			rcMonster.x = (m->x)*STEP_SIZE;
			sprintf(buffer2, "Points of attack: %d Points of defense: %d", j->attaque, j->defense);
			defatt = TTF_RenderText_Solid(font, buffer2, white);
		}
		if (keystate[SDLK_RIGHT] && (gameover != 2) ) {
			deplacement(g,j,100);
			sprintf(buffer, "Remaining lives: %d", j->vie);
			text = TTF_RenderText_Solid(font, buffer, white);
			if (g->content[j->y][j->x] == 8)
            {
                sprintf(buffer, "You won! Press Q or ESC to quit");
                text = TTF_RenderText_Solid(font, buffer, white);
                gameover = 2;
            }
			if (m -> vie > 0)
                deplacement_monstre(g, j, m);
            if (j->vie <=0 )
            {
                sprintf(buffer, "You lost! Press Q or ESC to quit");
                text = TTF_RenderText_Solid(font, buffer, white);
                gameover = 2;
            }
			rcSprite.x = (j->x)*STEP_SIZE;
			rcMonster.x = (m->x)*STEP_SIZE;
			sprintf(buffer2, "Points of attack: %d Points of defense: %d", j->attaque, j->defense);
			defatt = TTF_RenderText_Solid(font, buffer2, white);
		}
		if (keystate[SDLK_UP] && (gameover != 2) ) {
			deplacement(g,j,122);
			sprintf(buffer, "Remaining lives: %d", j->vie);
			text = TTF_RenderText_Solid(font, buffer, white);
			if (g->content[j->y][j->x] == 8)
            {
                sprintf(buffer, "You won! Press Q or ESC to quit");
                text = TTF_RenderText_Solid(font, buffer, white);
                gameover = 2;
            }
			if (m -> vie > 0)
                deplacement_monstre(g, j, m);
            if (j->vie <=0 )
            {
                sprintf(buffer, "You lost! Press Q or ESC to quit");
                text = TTF_RenderText_Solid(font, buffer, white);
                gameover = 2;
            }
			rcSprite.y = (j->y)*STEP_SIZE;
			rcMonster.y = (m->y)*STEP_SIZE;
			sprintf(buffer2, "Points of attack: %d Points of defense: %d", j->attaque, j->defense);
			defatt = TTF_RenderText_Solid(font, buffer2, white);
		}
		if (keystate[SDLK_DOWN] && (gameover != 2) ) {
			deplacement(g,j,115);
			sprintf(buffer, "Remaining lives: %d", j->vie);
			text = TTF_RenderText_Solid(font, buffer, white);
			if (g->content[j->y][j->x] == 8)
            {
                sprintf(buffer, "You won! Press Q or ESC to quit");
                text = TTF_RenderText_Solid(font, buffer, white);
                gameover = 2;
            }
			if (m -> vie > 0)
                deplacement_monstre(g, j, m);
            if (j->vie <=0 )
            {
                sprintf(buffer, "You lost! Press Q or ESC to quit");
                text = TTF_RenderText_Solid(font, buffer, white);
                gameover = 2;
            }
			rcSprite.y = (j->y)*STEP_SIZE;
			rcMonster.y = (m->y)*STEP_SIZE;
			sprintf(buffer2, "Points of attack: %d Points of defense: %d", j->attaque, j->defense);
			defatt = TTF_RenderText_Solid(font, buffer2, white);
		}


		if ( rcSprite.x < 0 ) {
			rcSprite.x = 0;
		}
		else if ( rcSprite.x > SCREEN_WIDTH-SPRITE_SIZE ) {
			rcSprite.x = SCREEN_WIDTH-SPRITE_SIZE;
		}
		if ( rcSprite.y < 0 ) {
			rcSprite.y = 0;
		}
		else if ( rcSprite.y > SCREEN_HEIGHT-SPRITE_SIZE ) {
			rcSprite.y = SCREEN_HEIGHT-SPRITE_SIZE;
		}



		for (int i = 0; i < (g -> n); i++)
		{
            for (int j = 0; j < (g -> m); j++)
            {
				switch (g->content[i][j])
				{
                    case 0 :
                        rcGrass.x = j * SPRITE_SIZE;
                        rcGrass.y = i * SPRITE_SIZE;
                        SDL_BlitSurface(backbg, NULL, screen, &rcGrass);
                    break;
                    case 1 :
                        rcWall.x = j * SPRITE_SIZE;
                        rcWall.y = i * SPRITE_SIZE;
                        SDL_BlitSurface(wall, NULL, screen, &rcWall);
                    break;
                    case 2 :
                        rcTrap.x = j * SPRITE_SIZE;
                        rcTrap.y = i * SPRITE_SIZE;
                        SDL_BlitSurface(trap, NULL, screen, &rcTrap);
                    break;
                    case 3 :
			rcGrass.x = j * SPRITE_SIZE;
                        rcGrass.y = i * SPRITE_SIZE;
                        SDL_BlitSurface(backbg, NULL, screen, &rcGrass);
                        rcLife.x = j * SPRITE_SIZE;
                        rcLife.y = i * SPRITE_SIZE;
                        SDL_BlitSurface(life, NULL, screen, &rcLife);
                    break;
                    case 6 :
			rcGrass.x = j * SPRITE_SIZE;
                        rcGrass.y = i * SPRITE_SIZE;
                        SDL_BlitSurface(backbg, NULL, screen, &rcGrass);
                        rcArmor.x = j * SPRITE_SIZE;
                        rcArmor.y = i * SPRITE_SIZE;
                        SDL_BlitSurface(armor, NULL, screen, &rcArmor);
                    break;
                    case 7 :
			rcGrass.x = j * SPRITE_SIZE;
                        rcGrass.y = i * SPRITE_SIZE;
                        SDL_BlitSurface(backbg, NULL, screen, &rcGrass);
                        rcSword.x = j * SPRITE_SIZE;
                        rcSword.y = i * SPRITE_SIZE;
                        SDL_BlitSurface(sword, NULL, screen, &rcSword);
                    break;
                    case 8 :
                        rcDoor.x = j * SPRITE_SIZE;
                        rcDoor.y = i * SPRITE_SIZE;
                        SDL_BlitSurface(door, NULL, screen, &rcDoor);
                    break;
                    default :
                        rcGrass.x = j * SPRITE_SIZE;
                        rcGrass.y = i * SPRITE_SIZE;
                        SDL_BlitSurface(backbg, NULL, screen, &rcGrass);
                    break;
                }

			}
		}

        drawRectCairo(screen);

		SDL_BlitSurface(sprite, NULL, screen, &rcSprite);

		if (m -> vie > 0)
			SDL_BlitSurface(monster, NULL, screen, &rcMonster);

		SDL_BlitSurface(text, NULL, screen, &rcText);

		SDL_BlitSurface(defatt, NULL, screen, &rcDefatt);

		SDL_UpdateRect(screen,0,0,0,0);
		}
    }

    TTF_CloseFont(font);
	TTF_Quit();

    SDL_FreeSurface(sprite);
    SDL_FreeSurface(backbg);
    SDL_FreeSurface(monster);
    SDL_FreeSurface(wall);
    SDL_FreeSurface(trap);
    SDL_FreeSurface(life);
    SDL_FreeSurface(sword);
    SDL_FreeSurface(armor);
    SDL_FreeSurface(door);
	SDL_FreeSurface(text);
	SDL_FreeSurface(defatt);
	SDL_FreeSurface(temp);
	SDL_FreeSurface(screen);

    suppr_grille(g);
    suppr_joueur(j);
    suppr_monstre(m);

    SDL_Quit();



    return 0;
}
示例#12
0
文件: Camera.cpp 项目: Rahotop/RTS
void Camera::update(Event & e)
{
	zoom(e);
	deplacement(e);
}
示例#13
0
文件: main.c 项目: Gornet/sokoban
int	main( int ac, char **av )
{
	char		c;
	partie_t	*partie;
	int		largeur;
	int		hauteur;
	int		score;
	static int	pos;

	if ( ac )
	{
		if ( av[1] )
		{
			if ( ft_check_location( av[1] ) )
			{
				if (ft_check_extension( av[1] ))
					ft_sokoban( av[1] );
				else
					ft_putendl("invalid extension");
			}
			else
				ft_putendl("invalid location");
		}
		else if ( av[1] == NULL )
		{
			largeur = 10;
			hauteur = 10;
			score = 1;
			alloc_memoire_partie( partie );
			partie->score = score;
			alloc_memoire_plateau( partie->p );
			alloc_memoire_plateau( partie->tampon );
			partie->p->largeur = largeur;
			partie->p->hauteur = hauteur;
			alloc_memoire_tableau( partie->p );
			partie->tampon->largeur = partie->p->largeur;
			partie->tampon->hauteur = partie->p->hauteur;
			alloc_memoire_tableau( partie->tampon );
			plateau( partie->p );
			tableau_tampon( partie->p, partie->tampon );
			afficher_tableau( partie->p );
			while( partie->p->tab[A] != 'C' )
			{	
				printf("Rentrez i pour aller en haut , k pour aller en bas ,");
				printf(" j pour aller a gauche , l pour aller a droite , ");
				printf("r pour revenir au coup precedent\n");
				scanf(" %c",&c);
				printf("\n\n");
				deplacement( c, partie->p, partie->tampon );
				tableau_tampon( partie->p, partie->tampon );
				system( "clear" );
				printf( "COUP N'%d\n\n\n\n",partie->score );
				afficher_tableau( partie->p );
				partie->score++;
			}
			printf( "Vous avez reussi\n" );
			endgame( partie );
		}
	}
	return ( 0 );
}
示例#14
0
void actualiserIndividus(Simulation* sim)
{

    Espece *espece = sim->premiereEspece;
    Individu *ind;
    Individu *indSuiv;
    Individu *proche=NULL;
    bool regulationVitesseActive=false;
    bool mangee=false;

    int dep=0;

    while(espece!=NULL)
    {
        ind=espece->premierIndividu;
        while(ind!=NULL)
        {


                indSuiv=ind->suivant; // sauvegarde l'individu suivant au cas où l'individu courant est désalloué par sa mort
                proche=NULL;
                regulationVitesseActive=false;
                dep=0;
                mangee=false;

                ///DEPLACEMENT
                dep=deplacement(ind,sim);
                if(dep)
                {
                    deplacementAleatoire(ind);
                }

                //on deplace l'individu suivant l'angle donné précédement.
                ind->position.x += ind->vitesse * cos((ind->direction)*M_PI/180.0) * sim->coeffTemps;
                ind->position.y -= ind->vitesse * sin((ind->direction)*M_PI/180.0) * sim->coeffTemps;


                ///ETAT EAU ET NOURRITURE ET FATIGUE
                if((ind->espece->type!=VEGETAL)&&((ind->stockEau>0)||(ind->stockNourriture>0)))
                {
                    if(ind->stockEau>0.1)
                    {
                        ind->stockEau-=0.1*sim->coeffTemps;
                        if(ind->stockEau<0)
                        {
                            ind->stockEau=0;
                        }
                    }
                    if(ind->stockNourriture>0.05)
                    {
                        ind->stockNourriture-=0.05*sim->coeffTemps;
                        if(ind->stockNourriture<0)
                        {
                            ind->stockNourriture=0;
                        }
                    }



                }
                if(ind->repos==0)
                {
                    ind->fatigue+=0.1*sim->coeffTemps;
                    if(ind->fatigue>100)
                        {
                            ind->fatigue=100;
                        }
                }

                if((ind->fatigue<10)&&(ind->repos==1))
                {
                    ind->repos=0;
                }
                if((ind->fatigue>90)&&(ind->repos==0))
                {
                    if((interactionIndividuMap(sim,ind)==TERRE)&&(Random(0,100)>95))
                    {
                        ind->vitesse=0;

                        ind->repos=1;
                    }
                }
                if(ind->repos)
                {
                    regulationVitesseActive=1;
                    ind->vitesse=0;
                    ind->fatigue-=0.5*sim->coeffTemps;
                    if(ind->fatigue<0)
                        {
                            ind->fatigue=0;
                        }
                }

                if((ind->stockEau<10)||(ind->stockNourriture<10))
                {
                    ind->vitesse=ind->espece->vitesseMoyenne*0.6;
                    regulationVitesseActive=true;
                }
                //stock eau
                if(interactionIndividuMap(sim,ind)==EAU)
                {
                    ind->stockEau=100;
                    ind->vitesse=ind->espece->vitesseMoyenne*0.7;
                    regulationVitesseActive=true;
                }

                if((ind->stockEau<1)||(ind->stockNourriture<1))
                {
                    ind->sante-=0.5*sim->coeffTemps;
                    if(ind->sante<0)
                        {
                            ind->sante=0;
                        }
                }
                else if(ind->sante<100)
                {
                    ind->sante+=0.5*sim->coeffTemps;
                    if(ind->sante>100)
                        {
                            ind->sante=100;
                        }
                }
                if(regulationVitesseActive==0)
                {
                    regulerVitesse(ind);
                }

                //boucle de verif

                if(ind->espece->type==VEGETAL)//reproduction plante
                {
                    if((ind->derniereReproduction+ind->espece->delaiProchaineReproduction)<(sim->tempsPasse))
                    {
                        if(Random(0,100)>75)
                        {

                           reproduction(ind,NULL,sim);

                        }
                    }
                }
                proche=quiEstProche(ind,sim);
                if(proche!=NULL)
                {
                    if(proche->espece->type==ind->espece->type)
                    {
                        if(proche->espece==ind->espece)
                        {
                            if(proche->sexe!=ind->sexe)
                            {
                                if((ind->derniereReproduction+ind->espece->delaiProchaineReproduction)<(sim->tempsPasse))
                                {
                                    reproduction(ind,proche,sim);
                                }
                            }

                        }

                    }
                    else
                    {
                       mangee=manger(ind,proche);
                    }



                }
                if(mangee==false)
                {
                    if(((ind->espece->dureeVieMoyenne+ind->naissance)<sim->tempsPasse)||(ind->sante==0))//durée de vie de l'individu
                    {
                        if(Random(0,100)>90)
                        {

                            mortIndividu(ind);

                        }
                    }

                }

        ind=indSuiv;
        }

        espece=espece->suivante;
    }


}