#TouhouDanmakufu
#Title[Full_Korbe NSC01]
#Text[Boss du stage 5, 1ere NSC]
#Image[]
#BGM[script\DanMUku\Stage5\fully.mp3]
#Player[script\DanMUku\Joueur\KorA\KorHosik.txt, script\DanMUku\Joueur\KorB\KorB.txt, script\DanMUku\Joueur\KorC\KorC.txt]
#ScriptVersion[2]

script_enemy_main
{    
    let imgEnemy ="script\DanMUku\Stage5\Image\fully.png";
    let count=-60;
    let munch ="script\DanMUku\Stage1\Son\muncher.wav";
    let z = 0;
    let w = 0.5;
	let vitesse = -2;
	let accel = 0.03;
	let rythme = 80;
	let type = 53;
   	let couleur=[38, 43, 40, 45, 47, 50];

   @Initialize
   {
            LoadUserShotData("script\DanMUku\MUtir\MUtir.txt");
            LoadGraphic(imgEnemy);
            SetLife(6000);
            SetTimer(30);
            SetInvincibility(160);
            SetEnemyMarker(true);
            SetMovePosition02(GetCenterX, GetCenterY-100, 120);          
   }
   
   @MainLoop
   {
          SetCollisionA(GetX, GetY, 16);
        SetCollisionB(GetX, GetY, 16);

	if (count%rythme==0 && count>0) {
		Explosion(rand(GetClipMinX, GetClipMaxX), rand(GetClipMinY, GetCenterY), vitesse, accel, type);
		type++;
		if (type>58) { type = 53;}
	}
	if (count>=720) {
		count-=720;
		rythme-=20;
	}

	count++;
   }
   @Finalize
   {
      DeleteGraphic(imgEnemy);
   }
   
   @DrawLoop
   {
            SetColor(255,255,255);
            SetRenderState(ALPHA);
            SetAlpha(255);
            SetTexture(imgEnemy);
            SetGraphicRect(0, 0, 35, 46);
            DrawGraphic(GetX,GetY+z);
     if(z==10){w=-0.5;}
     if(z==-10){w=0.5;}
z+=w;
	DrawText("Full_Korbe", GetClipMinX+10, GetClipMinY+15, 12, 255);
   }

	task Ligne(x, y, angle, v, a, type) {
		let acc = a;
		loop(5) {
			CreateShot02(x, y, v, angle, acc, 100, couleur[type-53], 50);
			acc+=a*0.05;
		}
		CreateShot02(x, y, v, angle, acc, 100, type, 50);
		acc+=a*0.05;
		PlaySE(munch);
	}

	task Explosion(x, y, v, a, type) {
		let angle = atan2(GetPlayerY-y, GetPlayerX-x);
		loop(30) {
			Ligne(x, y, angle, v, a, type);
			angle+=360/30;
		}

	}

}
