//////////////////////
//Sprite - 2500    //
//Code By Ayoros  //
///////////////////

function part21() {
    this.vbl = 0 ;
    this.canvaspart;
    this.text = new text_cursor() ;
    this.initdone = 0 ;

var angle1=0;
var angle2=0;
var particle_color=0;
var cpt_part=0;
var sprite_angle1=0.019;
var sprite_angle2=0.012;
var mycanvas2;
var diffangle1 = new Array();
diffangle1=[0.167,0.067,0.27];
var diffangle2 = new Array();
diffangle2=[0.003,0.063,-0.002];
var nbre_sprite=0;
var cpt_angle=0;

    this.init = function() {
    mycanvas2=new canvas(600,400);
     this.text.init(choix_text[2],10,8,font_key) ;

        this.initdone = 1 ;
     }

   
	function draw_sprite()	 		
	{
		angle1=angle1+sprite_angle1;
		angle2=angle2+sprite_angle2;
		
		var ta1=angle1;
		var ta2=angle2;
 
		var x=0;
		var y=0;
	
		for (b=0; b<nbre_sprite; b++)
		{
			x=280+120*Math.sin(ta1-ta2/2)+120*Math.cos(ta2);
			y=200-90*Math.cos(ta1)+90*Math.sin(ta2);
			

			ball_part[0].draw(mycanvas2,x,y);
		
			ta1+=diffangle1[cpt_angle];
			ta2+=diffangle2[cpt_angle];
		}
		
		/*
			particle_color++;
      if (particle_color>300) {cpt_part++;particle_color=0;}
      if (cpt_part>=particle.length){cpt_part=0;}
*/	}

    this.render = function(dest) {
        if (this.initdone == 0) { this.canvaspart = new canvas(600,400) ; this.init() ; }
         
          this.canvaspart.fill("rgba(0,0,0,0.2)");
          mycanvas2.clear();
          draw_sprite();
          mycanvas2.draw(this.canvaspart,0,0);
 
          nbre_sprite++;nbre_sprite++;
          if (nbre_sprite==2000){nbre_sprite=0;cpt_angle++;}
          if (cpt_angle==3){cpt_angle=0;}

          this.text.render(this.canvaspart,choix_pos[2].x,choix_pos[2].y) ;

          this.canvaspart.draw(dest,60,88);

        if (this.vbl<100) mycanvasblack.draw(dest,60,88,1-this.vbl/100);
        if (this.vbl>intro_parts[part_running].part_duration-100) mycanvasblack.draw(dest,60,88,1-(intro_parts[part_running].part_duration-this.vbl)/100);
        this.vbl++ ;
    }
return this;
}
///////////////
//END PART21//
/////////////
