Example #1
0
void anim_att4(SDL_Surface *ecran, int mstr)
{
	int i;
	for(i = 380; i > 100; i -= 70)
	{
		aff_img(ecran, "./imagem/boule.png",i, 240);
		SDL_Flip(ecran);
		eff_ecr(ecran, mstr);
	}
}
Example #2
0
void anim_att3(SDL_Surface *ecran, int mstr)
{
	int i;
	for(i = 0; i < 200; i += 50)
	{
		aff_img(ecran, "./imagem/thunder.png",120, i);
		SDL_Flip(ecran);
		usleep(100000);
		eff_ecr(ecran, mstr);
	}
}
Example #3
0
void anim_att2(SDL_Surface *ecran, int mstr)
{
	int i;
	for(i = 380; i > 100; i -= 70)
	{
		aff_img(ecran, "./imagem/poing.png",i, 240);
		SDL_Flip(ecran);
		usleep(100000);
		eff_ecr(ecran, mstr);
	}
}
Example #4
0
void anim_att1(SDL_Surface *ecran, int mstr)
{
	int i;
	char* dif_enemy[5] = 
	{
		"./imagem/mechant/voleur.png",
		"./imagem/mechant/zombie.png",
		"./imagem/mechant/vampire.png",
		"./imagem/mechant/wolf.png",
		"./imagem/mechant/cat.png"
	};
	for(i = 500; i > 100; i -= 70)
	{
		aff_img(ecran, "./imagem/bataille.png", 0, 0);
	  	aff_img(ecran, "./imagem/perso.png", 100, 220);
    	if (mstr == 5)
        aff_img(ecran, "./imagem/mechant/boss.png", i - 50, 180);
    	else
        aff_img(ecran, dif_enemy[mstr], i, 240);
		SDL_Flip(ecran);
	}
	eff_ecr(ecran, mstr);
}
void		aff_new_content(int content, SDL_Surface *win)
{
  SDL_Surface	*image;

  image = aff_img(win);
  image = image;
  if (content == 1)
    {
      part_type = 1;
      aff_choose_map(win);
    }
  else if (content == 2)
    {
      part_type = 0;
      aff_choose_map(win);
    }
  else if (content == 3)
    {
      launch_menu(win);
    }
  else
    exit(0);
}
void		choose_map(SDL_Surface *win, TTF_Font *police, SDL_Color red,
			   SDL_Rect pos, SDL_Surface *texte)
{
  SDL_Surface *num;
  SDL_Event	event;
  int		n;
  SDL_Rect pos2;
  SDL_Surface	*image;

  image = aff_img(win);
  n = 1;
  pos2.x = 550;
  pos2.y = 542;
  num = TTF_RenderText_Blended(police, "   1 ->", red);
  SDL_BlitSurface(texte, NULL, win, &pos);
  SDL_BlitSurface(num, NULL, win, &pos2);
  SDL_Flip(win);
  while (1)
    {
      SDL_WaitEvent(&event);
      switch(event.type)
	{
	case SDL_QUIT:
	  exit(0);
	  break;
	case SDL_KEYDOWN:
	  switch(event.key.keysym.sym)
            {
            case SDLK_LEFT:
	      if (n != 1)
		n--;
              break;
            case SDLK_RIGHT:
	      if (n != 5)
		n++;
              break;
	    case SDLK_ESCAPE:
	      SDL_FreeSurface(win);
	      exit(EXIT_FAILURE);
	      break;
            default:
	      SDL_FreeSurface(win);
	      load_level(n);
	      return ;
	      break;
	    }
	}
      SDL_FreeSurface(num);
      SDL_FreeSurface(image);
      image = aff_img(win);
      num = TTF_RenderText_Blended(police, "   1 ->", red);
      if (n == 1)
	num = TTF_RenderText_Blended(police, "   1 ->", red);
      if (n == 2)
	num = TTF_RenderText_Blended(police, "<- 2 ->", red);
      if (n == 3)
	num = TTF_RenderText_Blended(police, "<- 3 ->", red);
      if (n == 4)
	num = TTF_RenderText_Blended(police, "<- 4 ->", red);
      if (n == 5)
	num = TTF_RenderText_Blended(police, "<- 5   ", red);
      SDL_BlitSurface(num, NULL, win, &pos2);
      SDL_BlitSurface(texte, NULL, win, &pos);
      SDL_Flip(win);
    }
}