/*
Nom : storm
Entrées :
Sorties :
Date de dernière modification : 27/04
Nature de la dernière modification :réimplantation
Version : 2.0
*/
int storm(BITMAP* img[BMP_NB],t_hero tab[MAX_HERO],t_game* level, int x, int y, int i, int nb,SAMPLE* son[SON_NB])
{
	int jaune = makecol(255,255,0); //souffle
	int distx = tab[i].p4x - x;
	int disty = tab[i].p4y - y;
	distx = abs(distx);
	disty = abs(disty);

	int spacefor9 = distx / 9;

	int anim_here = 26;
	int anim_max_here = 4;
    int max_here = 38;
	//anim strom
	if (anim_here + nb < anim_here + anim_max_here)
	{
	    sound(son,level,4);
		if (x > tab[i].x) masked_blit(img[anim_here+nb], img[7], 0,0, tab[i].x, tab[i].y, img[anim_here+nb]->w, img[anim_here+nb]->h);
		else draw_sprite_h_flip(img[7], img[anim_here+nb], tab[i].x, tab[i].y);
		tab[i].save = tab[i].x;
	}
	//for anim souffle
	if (anim_here + nb >= anim_here + anim_max_here)
	{
        if (x > tab[i].save) masked_blit(img[29], img[7], 0,0, tab[i].save, tab[i].y, img[29]->w, img[29]->h);
		else draw_sprite_h_flip(img[7], img[29], tab[i].save, tab[i].y);

		if ( x > tab[i].x )
		{
			masked_blit(img[anim_here+nb], img[7],0,0, tab[i].next_pouv_x, tab[i].y, img[anim_here+nb]->w, img[anim_here+nb]->h);
			tab[i].next_pouv_x = tab[i].next_pouv_x + spacefor9;
		}
		else
		{
			draw_sprite_h_flip(img[7], img[anim_here+nb], tab[i].next_pouv_x, tab[i].y);
			tab[i].next_pouv_x = tab[i].next_pouv_x - spacefor9;
		}
	}
	//mettage du fond jaune de souffle et de la bitmap indiquant le souffle
	//masked_stretch_blit(img[30],img[7], tab[i].x + TX, tab[i].y, img[30]->w, img[30]->h, x, y + TY, distx, img[i]->h ); //ATTENTION NE PREND EN COMPTE QUE LE CAS HORIZONTAL
	if (anim_here + nb == max_here)
		{
			pivot_scaled_sprite(img[7], img[39], tab[i].x + TX, tab[i].y, 35, 22, itofix( (tab[i].direction == 'D' ?  0 : 128) + (int)(atan2(tab[i].y - y,tab[i].x - x)*256)/(2*M_PI)), ftofix(sqrt( pow(x - tab[i].x, 2) +  pow(y - tab[i].y, 2) ) / img[46]->w));
            pivot_scaled_sprite(level->fore, img[39], tab[i].x + TX, tab[i].y, 35, 22, itofix( (tab[i].direction == 'D' ?  0 : 128) + (int)(atan2(tab[i].y - y,tab[i].x - x)*256)/(2*M_PI)), ftofix(sqrt( pow(x - tab[i].x, 2) +  pow(y - tab[i].y, 2) ) / img[46]->w));
			tab[i].transformation = 2;
			rectfill(level->collision, tab[i].x + TX, tab[i].y, x, y + TY, jaune );
			return 0;
		}
    return 1;
}
/*
Nom : cyclope
Entrées :
Sorties :
Date de dernière modification : 27/04
Nature de la dernière modification : réimplantation
Version : 2.0
*/
void cyclope(BITMAP* img[BMP_NB],t_hero tab[MAX_HERO],t_game* level, int x, int y, int i, int nb,SAMPLE* son[SON_NB])
{
	int noir = makecol(0,0,0); //fond
    int silver = makecol(192,192,192); //zone trait
    int pink = makecol(255,0,255); //true pink
    int j;

    int anim_here = 41;
	int anim_max_here = 2;

    //anim cyclope
    if (anim_here + nb < anim_here + anim_max_here)
	{
	    sound(son,level,6);
		if (x > tab[i].x) masked_blit(img[anim_here+nb], img[7], 0,0, tab[i].x, tab[i].y, img[anim_here+nb]->w, img[anim_here+nb]->h);
		else draw_sprite_h_flip(img[7], img[anim_here], tab[i].x, tab[i].y);
		tab[i].save = tab[i].x;
	}


	if (anim_here + nb == 43 )
    {
        pivot_scaled_sprite(img[7], img[43], tab[i].x + TX, tab[i].y, 2, 22, itofix( (tab[i].direction == 'D' ?  0 : 128) + (int)(atan2(tab[i].y - y,tab[i].x - x)*256)/(2*M_PI)), ftofix(sqrt( pow(x - tab[i].x, 2) +  pow(y - tab[i].y, 2) ) / img[46]->w));
        tab[i].transformation = 2;

        line(level->collision, tab[i].x + TX/2, tab[i].y+5, x, y, silver); //mets de l'argent sur la collision

        //coloriage de la zone autour du gris en noir pour creuser
        int k,l;
        for (k = 0; k < 1000 ; k++)
        {
            for(l = 0; l < 700; l++)
            {
                if (getpixel(level->collision,k,l) == silver)
                {
                    j = 0;
                    for(j = 0; j < 45; j ++)
                    {
                        putpixel(level->collision, k + j, l + j, noir);//sur la bitmap de collision
                        putpixel(level->collision, k - j, l - j, noir);

                        putpixel(level->fore, k + j, l + j, pink); //image de devant
                        putpixel(level->fore, k - j, l - j, pink);
                    }

                }
            }
        }
        tab[i].activated = 0;
    }


}
Exemple #3
0
void PARTICLE::draw(DISPLAY& disp)
{
    int drawX = disp.toScreenX((int) x);
	int drawY = disp.toScreenY((int) y);
	BITMAP * fsprite = data.frames[(int)frame_index];

	// create subsprite
	if ((data.particle_type == 1 || data.particle_type == 2) && start_len < fsprite->w*2) {
		if ((int)frame_index != prev_frameindex) {
			prev_frameindex = (int)frame_index;
			if (sprite && is_subimg) destroy_bitmap(sprite);
			sprite = create_sub_bitmap(fsprite, fsprite->w/2 - start_len/2, 0, (start_len > 20) ? start_len : 20, fsprite->h);
		}
	} else {
		sprite = fsprite;
		is_subimg = false;
	}

	// draw
	if (data.particle_type == 0 || data.particle_type == 3) pivot_sprite(disp.buffer, sprite, drawX, drawY, sprite->w / 2, sprite->h / 2, itofix( (int) (theta / M_PI * 256/2) ));
	else if (data.particle_type == 1 || data.particle_type == 2) pivot_scaled_sprite(disp.buffer, sprite, drawX, drawY, 0, sprite->h / 2, itofix( (int) (theta / M_PI * 256/2) ), ftofix(expansion * (double)starting_life/(double)sprite->w));
}
Exemple #4
0
void Boss1Gun::draw(BitmapManager *bmpMan){
     pivot_scaled_sprite(bmpMan->buffer,img,x,y,14,24,ftofix(angle),ftofix(1.5));
}