#e
#Title[z剃P]
#Text[]
#BackGround[User(.\img\Sky.png,0,0)]
#BGM[]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
	let csd		=GetCurrentScriptDirectory;
	let shotData	=csd ~ "img\shot_All.txt";
	let imgBoss	=csd ~ "img\Boss\dot_sakuya.png";
	let Back	=csd ~ "img\Sky.png";
	let bg		=csd ~ "bgm\bgm.mp3";

	@Initialize {
        SetLife(1);
	SetScore(447);
	SetDamageRate(0, 0);
	InitializeAction();
	LoadUserShotData(shotData);
	LoadGraphic(imgBoss);
	LoadGraphic(Back);
	LoadMusic(bg);
	Load;
	Expert;
        CutIn(YOUMU,"Juz剃v", NULL, 0, 0, 0, 0);
        Main;
	}

    @MainLoop {
        SetCollisionA(GetX, GetY, 32);
        SetCollisionB(GetX, GetY, 16);
        yield;
    }

	@DrawLoop {
	SetColor(255,255,255);
	SetGraphicScale(1,1);
	SetAlpha(255);
	DrawBoss(imgBoss);
	}

	@BackGround {
	SetTexture(Back);
	SetGraphicRect(0, 0, 384, 457);
	SetGraphicAngle(0, 0, 0);
	DrawGraphic(224, 240);
	}

    task Main {
	yield;
	standBy;
	wait(60);
	Att;
}

	sub standBy {
		SetMovePosition03(224, 180, 10, 7);
		SetAction(ACT_MOVE, 60);
		wait(120);
}

task Att{
	CreateEnemyFromScript("MEIRIN", 416, -60, 0, 0, 0);
	CreateEnemyFromScript("DEVIL", 0, -20, 0, 0, 0);
	CreateEnemyFromScript("PATCH", 416, -20, 0, 0, 0);
	CreateEnemyFromScript("REMILIA", 120, -20, 0, 0, 0);
	CreateEnemyFromScript("FLAN", 328, -20, 0, 0, 0);
	CreateEnemyFromScript("YUYUKO", 0, -20, 0, 0, 0);
	CreateEnemyFromScript("YOUMU", 416, -20, 0, 0, 0);
	PlayMusic(bg);
	wait(30);
	SetAction(ACT_SHOT_B, 480);
	shotA;
	wait(270);
	wait(300);
	SetMovePosition03(224, -60, 10, 7);
	SetAction(ACT_MOVE_R, 240);
	wait(1820);
	AddLife(-1);	
}

task shotA{
	loop(9){
	let angle=0;
	while(angle<360){
	CreateShot01(GetX, GetY, 3, angle, 145, 0);
	CreateShot01(GetX, GetY, 2, angle+90, 147, 0);
	CreateShot01(GetX, GetY, 4, angle+180, 148, 0);
	CreateShot01(GetX, GetY, 2.5, angle+270, 150, 0);
	angle+=12;
	wait(2);
	}
	yield;
	}
}

	@Finalize{
	DeleteGraphic(imgBoss);
	Delete;
	}

	#include_function ".\lib\lib_anime_Sakuya.txt"
	#include_function ".\lib_Functions.txt"
}


script_enemy MEIRIN{
	let csd     = GetCurrentScriptDirectory;
	let shotData	=csd ~ "img\shot_All.txt";
	let imgBoss  = csd ~ "img\Boss\dot_meirin.png";

	@Initialize{
        SetLife(1);
	SetDamageRate(0, 0);
	InitializeAction();
	LoadUserShotData(shotData);
	LoadGraphic(imgBoss);
	Load;
	Main;
	}

	@MainLoop{
        SetCollisionA(GetX, GetY, 32);
        SetCollisionB(GetX, GetY, 16);
	yield;
	}

	@DrawLoop{
	SetColor(255,255,255);
	SetGraphicScale(1,1);
	SetAlpha(255);
	DrawBoss(imgBoss);
	}

task	Main{
	yield;
	wait(300);
	standBy;
	Att;	
}

	sub standBy {
		SetMovePosition03(360, 120, 10, 7);
		SetAction(ACT_MOVE, 60);
		wait(120);
}

task Att{
	wait(30);
	SetAction(ACT_SHOT_A, 240);
	shot;
	wait(270);
	SetAngle(180);
	SetSpeed(3);
	SetAction(ACT_MOVE_L, 300);
}

task shot{
	loop(9){
	let angle=GetAngleToPlayer;
	CreateShot01(GetX, GetY, 4, angle, 166, 0);
	CreateShot01(GetX, GetY, 4, angle+36, 166, 0);
	CreateShot01(GetX, GetY, 4, angle-36, 166, 0);
	CreateShot01(GetX, GetY, 4, angle+72, 166, 0);
	CreateShot01(GetX, GetY, 4, angle-72, 166, 0);	
	wait(30);
	}
}

	@Finalize{
	DeleteGraphic(imgBoss);
	Delete;
	}

	#include_function ".\lib\lib_anime_Sakuya.txt"
	#include_function ".\lib_Functions.txt"
}


script_enemy DEVIL{
	let csd     = GetCurrentScriptDirectory;
	let shotData	=csd ~ "img\shot_All.txt";
	let imgBoss  = csd ~ "img\Boss\dot_devil.png";

	@Initialize{
        SetLife(1);
	SetDamageRate(0, 0);
	InitializeAction();
	LoadUserShotData(shotData);
	LoadGraphic(imgBoss);
	Load;
	Main;
	}

	@MainLoop{
        SetCollisionA(GetX, GetY, 32);
        SetCollisionB(GetX, GetY, 16);
	yield;
	}

	@DrawLoop{
	SetColor(255,255,255);
	SetGraphicScale(1,1);
	SetAlpha(255);
	DrawBoss(imgBoss);
	}

task	Main{
	yield;
	wait(600);
	standBy;
	Att;	
}

	sub standBy {
		SetMovePosition03(144, 200, 10, 7);
		SetAction(ACT_MOVE, 60);
		wait(120);
}

task Att{
	SetAction(ACT_SHOT_A, 420);
	shot;
	wait(450);
	SetAngle(0);
	SetSpeed(6);
	SetAction(ACT_MOVE_R, 240);
}

task shot{
	let A=0;
	loop(18){
	let angle=0;
	while(angle<360){
	CreateLaser01(GetX, GetY, 4, angle+A, 90, 10, RED01, 0);
	angle+=30;
	wait(2);
	}
	A+=10;	
	}	
}

	@Finalize{
	DeleteGraphic(imgBoss);
	Delete;
	}

	#include_function ".\lib\lib_anime_Devil.txt"
	#include_function ".\lib_Functions.txt"
}


script_enemy PATCH{
	let csd     = GetCurrentScriptDirectory;
	let shotData	=csd ~ "img\shot_All.txt";
	let imgBoss  = csd ~ "img\Boss\dot_patchouli.png";

	@Initialize{
        SetLife(1);
	SetDamageRate(0, 0);
	InitializeAction();
	LoadUserShotData(shotData);
	LoadGraphic(imgBoss);
	Load;
	Main;
	}

	@MainLoop{
        SetCollisionA(GetX, GetY, 32);
        SetCollisionB(GetX, GetY, 16);
	yield;
	}

	@DrawLoop{
	SetColor(255,255,255);
	SetGraphicScale(1,1);
	SetAlpha(255);
	DrawBoss(imgBoss);
	}

task	Main{
	yield;
	wait(660);
	standBy;
	Att;	
}

	sub standBy {
		SetMovePosition03(304, 140, 10, 7);
		SetAction(ACT_MOVE, 60);
		wait(120);
}

task Att{
	SetAction(ACT_SHOT_A, 360);
	shotA;
	shotB;
	shotC;
	wait(390);
	SetAngle(180);
	SetSpeed(6);
	SetAction(ACT_MOVE_L, 240);
}

task shotA{
	loop(3){
	let time=0;
	while(time<360){
	let angle=0;
	while(angle<360){
	CreateShot01(GetX+60*sin(time), GetY+60*cos(time), 3, angle+time, 243, 0);
	angle+=120;
	}
	time+=6;
	wait(2);
	}
	}	
}

task shotB{
	loop(3){
	let time=0;
	while(time<360){
	let angle=0;
	while(angle<360){
	CreateShot01(GetX+60*sin(time+120), GetY+60*cos(time+120), 2, +angle-time, 246, 0);
	angle+=120;
	}
	time+=6;
	wait(2);
	}
	}	
}

task shotC{
	loop(3){
	let time=0;
	while(time<360){
	let angle=0;
	while(angle<360){
	CreateShot01(GetX+60*sin(time+240), GetY+60*cos(time+240), 4, angle, 247, 0);
	angle+=60;
	}
	time+=6;
	wait(2);
	}
	}	
}

	@Finalize{
	DeleteGraphic(imgBoss);
	Delete;
	}

	#include_function ".\lib\lib_anime_Patchouli.txt"
	#include_function ".\lib_Functions.txt"
}


script_enemy REMILIA{
	let csd     = GetCurrentScriptDirectory;
	let shotData	=csd ~ "img\shot_All.txt";
	let imgBoss  = csd ~ "img\Boss\dot_remilia.png";

	@Initialize{
        SetLife(1);
	SetDamageRate(0, 0);
	InitializeAction();
	LoadUserShotData(shotData);
	LoadGraphic(imgBoss);
	Load;
	Main;
	}

	@MainLoop{
        SetCollisionA(GetX, GetY, 32);
        SetCollisionB(GetX, GetY, 16);
	yield;
	}

	@DrawLoop{
	SetColor(255,255,255);
	SetGraphicScale(1,1);
	SetAlpha(255);
	DrawBoss(imgBoss);
	}

task	Main{
	yield;
	wait(1140);
	standBy;
	Att;	
}

	sub standBy {
		SetMovePosition03(124, 240, 10, 7);
		SetAction(ACT_MOVE, 60);
		wait(120);
}

task Att{
	shot;
	wait(450);
	SetAngle(180);
	SetSpeed(7);
	SetAction(ACT_MOVE_L, 240);
}


task shot{
	let angle=195;
	let color=2;
	SetAction(ACT_SHOT_A, 150);
	while(angle<345){
	shotA(angle, color);
	angle+=30;
	color++;
	wait(10);
	}
	wait(240);
	SetAction(ACT_SHOT_B, 60);
	shotB;
}

task shotA(let angle, let color){
	CreateReflectShot(GetX, GetY, 4, angle, color+164, 0, 4);
	CreateReflectShot(GetX, GetY, 3.5, angle+rand(-2, 2), color+24, 0, 2);
	CreateReflectShot(GetX, GetY, 3.5, angle+rand(-2, 2), color+24, 0, 2);
	CreateReflectShot(GetX, GetY, 2.5, angle+rand(-8, 8), color+8, 0, 2);
	CreateReflectShot(GetX, GetY, 2.5, angle+rand(-8, 8), color+8, 0, 2);
	CreateReflectShot(GetX, GetY, 1, angle+rand(-15, 15), color+8, 0, 2);
	CreateReflectShot(GetX, GetY, 1, angle+rand(-15, 15), color+8, 0, 2);
	CreateReflectShot(GetX, GetY, 1.5, angle+rand(-20, 20), color+8, 0, 2);
	CreateReflectShot(GetX, GetY, 1.5, angle+rand(-20, 20), color+8, 0, 2);
	CreateReflectShot(GetX, GetY, 2.5, angle+rand(-13, 13), color+24, 0, 2);
	CreateReflectShot(GetX, GetY, 2.5, angle+rand(-13, 13), color+24, 0, 2);
	CreateReflectShot(GetX, GetY, 2, angle+rand(-24, 24), color+8, 0, 2);
	CreateReflectShot(GetX, GetY, 2, angle+rand(-24, 24), color+8, 0, 2);
}

task CreateReflectShot(let x, let y, let speed, let angle, let graphic, let delay, let count) {
    
    let obj = Obj_Create(OBJ_SHOT);
    
    Obj_SetPosition(obj, x, y);
    Obj_SetSpeed(obj, speed);
    Obj_SetAngle(obj, angle);
    ObjShot_SetGraphic(obj, graphic);
    ObjShot_SetDelay(obj, delay);
    
    loop(delay){ yield; }
    
    while(!Obj_BeDeleted(obj)) {
        if(Obj_GetX(obj)<GetClipMinX){
            Obj_SetX(obj, GetClipMinX*2 - Obj_GetX(obj));
            Obj_SetAngle(obj, 180 - Obj_GetAngle(obj));
	count--;
        }
        if(Obj_GetX(obj)>GetClipMaxX){
            Obj_SetX(obj, GetClipMaxX*2 - Obj_GetX(obj));
            Obj_SetAngle(obj, 180 - Obj_GetAngle(obj));
	count--;
        }
        if(Obj_GetY(obj)<GetClipMinY){
            Obj_SetY(obj, GetClipMinY*2 - Obj_GetY(obj));
            Obj_SetAngle(obj, 360 - Obj_GetAngle(obj));
	count--;
        }
  
        if(count<=0){ break; }
    
        yield;
    }
}

task shotB{
	let angle=30;
	let A=-40;
	while(angle<=300){
	CreateLaserA(1, GetX, GetY, 480, 40, RED01, 0);
	SetLaserDataA(1, 0, -angle, 0, 0, 0, 0);
	SetShotKillTime(1, 20);
	CreateShotA(2, 20*cos(-angle-90), 20*sin(-angle-90), 0);
	SetShotDataA(2, 0, 0, -angle+A, 0, 0, 1, 41);
	SetShotDataA(2, 60, 0, -angle-90, 0, 0.1, 2, 41);
	AddShot(5, 1, 2, 0);
	CreateShotA(3, 40*cos(-angle-60), 40*sin(-angle-60), 0);
	SetShotDataA(3, 0, 0, -angle+A, 0, 0, 1, 41);
	SetShotDataA(3, 60, 0, -angle-90, 0, 0.1, 2, 41);
	AddShot(5, 1, 3, 0);
	CreateShotA(4, 100*cos(-angle), 100*sin(-angle), 0);
	SetShotDataA(4, 0, 0, -angle+A, 0, 0, 1, 41);
	SetShotDataA(4, 60, 0, -angle-90, 0, 0.1, 2, 41);
	AddShot(5, 1, 4, 0);
	CreateShotA(5, 100*cos(-angle-5), 100*sin(-angle-5), 0);
	SetShotDataA(5, 0, 0, -angle+A, 0, 0, 1, 41);
	SetShotDataA(5, 60, 0, -angle-90, 0, 0.1, 2, 41);
	AddShot(5, 1, 5, 0);
	CreateShotA(6, 140*cos(-angle), 140*sin(-angle), 0);
	SetShotDataA(6, 0, 0, -angle+A, 0, 0, 1, 41);
	SetShotDataA(6, 60, 0, -angle-90, 0, 0.1, 2, 41);
	AddShot(5, 1, 6, 0);
	CreateShotA(7, 140*cos(-angle-5), 140*sin(-angle-5), 0);
	SetShotDataA(7, 0, 0, -angle+A, 0, 0, 1, 41);
	SetShotDataA(7, 60, 0, -angle-90, 0, 0.1, 2, 41);
	AddShot(5, 1, 7, 0);
	CreateShotA(8, 180*cos(-angle), 180*sin(-angle), 0);
	SetShotDataA(8, 0, 0, -angle+A, 0, 0, 1, 41);
	SetShotDataA(8, 60, 0, -angle-90, 0, 0.1, 2, 41);
	AddShot(5, 1, 8, 0);
	CreateShotA(9, 180*cos(-angle-5), 180*sin(-angle-5), 0);
	SetShotDataA(9, 0, 0, -angle+A, 0, 0, 1, 41);
	SetShotDataA(9, 60, 0, -angle-90, 0, 0.1, 2, 41);
	AddShot(5, 1, 9, 0);
	CreateShotA(10, 220*cos(-angle), 220*sin(-angle), 0);
	SetShotDataA(10, 0, 0, -angle+A, 0, 0, 1, 41);
	SetShotDataA(10, 60, 0, -angle-90, 0, 0.1, 2, 41);
	AddShot(5, 1, 10, 0);
	CreateShotA(11, 220*cos(-angle-5), 220*sin(-angle-5), 0);
	SetShotDataA(11, 0, 0, -angle+A, 0, 0, 1, 41);
	SetShotDataA(11, 60, 0, -angle-90, 0, 0.1, 2, 41);
	AddShot(5, 1, 11, 0);
	CreateShotA(12, 260*cos(-angle), 260*sin(-angle), 0);
	SetShotDataA(12, 0, 0, -angle+A, 0, 0, 1, 41);
	SetShotDataA(12, 60, 0, -angle-90, 0, 0.1, 2, 41);
	AddShot(5, 1, 12, 0);
	CreateShotA(13, 260*cos(-angle-5), 260*sin(-angle-5), 0);
	SetShotDataA(13, 0, 0, -angle+A, 0, 0, 1, 41);
	SetShotDataA(13, 60, 0, -angle-90, 0, 0.1, 2, 41);
	AddShot(5, 1, 13, 0);
	CreateLaserA(14, GetX, GetY, 480, 40, RED01, 0);
	SetLaserDataA(14, 0, -angle+7, 0, 0, 0, 0);
	SetShotKillTime(14, 15);
	FireShot(1);
	FireShot(14);
	angle+=15;
	A+=15;
	wait(4);
	}
}

	@Finalize{
	DeleteGraphic(imgBoss);
	Delete;
	}

	#include_function ".\lib\lib_anime_Remilia.txt"
	#include_function ".\lib_Functions.txt"
}


script_enemy FLAN{
	let csd     = GetCurrentScriptDirectory;
	let shotData	=csd ~ "img\shot_All.txt";
	let imgBoss  = csd ~ "img\Boss\dot_flandre.png";

	@Initialize{
        SetLife(1);
	SetDamageRate(0, 0);
	InitializeAction();
	LoadUserShotData(shotData);
	LoadGraphic(imgBoss);
	Load;
	Main;
	}

	@MainLoop{
        SetCollisionA(GetX, GetY, 32);
        SetCollisionB(GetX, GetY, 16);
	yield;
	}

	@DrawLoop{
	SetColor(255,255,255);
	SetGraphicScale(1,1);
	SetAlpha(255);
	DrawBoss(imgBoss);
	}

task	Main{
	yield;
	wait(1140);
	standBy;
	Att;	
}

	sub standBy {
		SetMovePosition03(324, 240, 10, 7);
		SetAction(ACT_MOVE, 60);
		wait(120);
}

task Att{
	shot;
	wait(450);
	SetAngle(0);
	SetSpeed(7);
	SetAction(ACT_MOVE_R, 240);
}

task shot{
	let angle=15;
	let color=2;
	SetAction(ACT_SHOT_A, 150);
	while(angle<165){
	shotA(-angle, color);
	angle+=30;
	color++;
	wait(10);
	}
	wait(240);
	SetAction(ACT_SHOT_B, 60);
	shotB;
}

task shotA(let angle, let color){
	CreateReflectShot(GetX, GetY, 4, angle, color+164, 0, 4);
	CreateReflectShot(GetX, GetY, 3.5, angle+rand(-2, 2), color+24, 0, 2);
	CreateReflectShot(GetX, GetY, 3.5, angle+rand(-2, 2), color+24, 0, 2);
	CreateReflectShot(GetX, GetY, 2.5, angle+rand(-8, 8), color+8, 0, 2);
	CreateReflectShot(GetX, GetY, 2.5, angle+rand(-8, 8), color+8, 0, 2);
	CreateReflectShot(GetX, GetY, 1, angle+rand(-15, 15), color+8, 0, 2);
	CreateReflectShot(GetX, GetY, 1, angle+rand(-15, 15), color+8, 0, 2);
	CreateReflectShot(GetX, GetY, 1.5, angle+rand(-20, 20), color+8, 0, 2);
	CreateReflectShot(GetX, GetY, 1.5, angle+rand(-20, 20), color+8, 0, 2);
	CreateReflectShot(GetX, GetY, 2.5, angle+rand(-13, 13), color+24, 0, 2);
	CreateReflectShot(GetX, GetY, 2.5, angle+rand(-13, 13), color+24, 0, 2);
	CreateReflectShot(GetX, GetY, 2, angle+rand(-24, 24), color+8, 0, 2);
	CreateReflectShot(GetX, GetY, 2, angle+rand(-24, 24), color+8, 0, 2);
}

task shotB{
	let angle=-150;
	let A=-80;
	while(angle<=120){
	CreateLaserA(1, GetX, GetY, 480, 40, RED01, 0);
	SetLaserDataA(1, 0, angle, 0, 0, 0, 0);
	SetShotKillTime(1, 20);
	CreateShotA(2, 20*cos(angle+90), 20*sin(angle+90), 0);
	SetShotDataA(2, 0, 0, angle-A, 0, 0, 1, 41);
	SetShotDataA(2, 60, 0, angle+90, 0, 0.1, 2, 41);
	AddShot(5, 1, 2, 0);
	CreateShotA(3, 40*cos(angle+60), 40*sin(angle+60), 0);
	SetShotDataA(3, 0, 0, angle-A, 0, 0, 1, 41);
	SetShotDataA(3, 60, 0, angle+90, 0, 0.1, 2, 41);
	AddShot(5, 1, 3, 0);
	CreateShotA(4, 100*cos(angle), 100*sin(angle), 0);
	SetShotDataA(4, 0, 0, angle-A, 0, 0, 1, 41);
	SetShotDataA(4, 60, 0, angle+90, 0, 0.1, 2, 41);
	AddShot(5, 1, 4, 0);
	CreateShotA(5, 100*cos(angle+5), 100*sin(angle+5), 0);
	SetShotDataA(5, 0, 0, angle-A, 0, 0, 1, 41);
	SetShotDataA(5, 60, 0, angle+90, 0, 0.1, 2, 41);
	AddShot(5, 1, 5, 0);
	CreateShotA(6, 140*cos(angle), 140*sin(angle), 0);
	SetShotDataA(6, 0, 0, angle-A, 0, 0, 1, 41);
	SetShotDataA(6, 60, 0, angle+90, 0, 0.1, 2, 41);
	AddShot(5, 1, 6, 0);
	CreateShotA(7, 140*cos(angle+5), 140*sin(angle+5), 0);
	SetShotDataA(7, 0, 0, angle-A, 0, 0, 1, 41);
	SetShotDataA(7, 60, 0, angle+90, 0, 0.1, 2, 41);
	AddShot(5, 1, 7, 0);
	CreateShotA(8, 180*cos(angle), 180*sin(angle), 0);
	SetShotDataA(8, 0, 0, angle-A, 0, 0, 1, 41);
	SetShotDataA(8, 60, 0, angle+90, 0, 0.1, 2, 41);
	AddShot(5, 1, 8, 0);
	CreateShotA(9, 180*cos(angle+5), 180*sin(angle+5), 0);
	SetShotDataA(9, 0, 0, angle-A, 0, 0, 1, 41);
	SetShotDataA(9, 60, 0, angle+90, 0, 0.1, 2, 41);
	AddShot(5, 1, 9, 0);
	CreateShotA(10, 220*cos(angle), 220*sin(angle), 0);
	SetShotDataA(10, 0, 0, angle-A, 0, 0, 1, 41);
	SetShotDataA(10, 60, 0, angle+90, 0, 0.1, 2, 41);
	AddShot(5, 1, 10, 0);
	CreateShotA(11, 220*cos(angle+5), 220*sin(angle+5), 0);
	SetShotDataA(11, 0, 0, angle-A, 0, 0, 1, 41);
	SetShotDataA(11, 60, 0, angle+90, 0, 0.1, 2, 41);
	AddShot(5, 1, 11, 0);
	CreateShotA(12, 260*cos(angle), 260*sin(angle), 0);
	SetShotDataA(12, 0, 0, angle-A, 0, 0, 1, 41);
	SetShotDataA(12, 60, 0, angle+90, 0, 0.1, 2, 41);
	AddShot(5, 1, 12, 0);
	CreateShotA(13, 260*cos(angle+5), 260*sin(angle+5), 0);
	SetShotDataA(13, 0, 0, angle-A, 0, 0, 1, 41);
	SetShotDataA(13, 60, 0, angle+90, 0, 0.1, 2, 41);
	AddShot(5, 1, 13, 0);
	CreateLaserA(14, GetX, GetY, 480, 40, RED01, 0);
	SetLaserDataA(14, 0, angle-7, 0, 0, 0, 0);
	SetShotKillTime(14, 15);
	FireShot(1);
	FireShot(14);
	angle+=15;
	A+=15;
	wait(4);
	}
}

task CreateReflectShot(let x, let y, let speed, let angle, let graphic, let delay, let count) {
    
    let obj = Obj_Create(OBJ_SHOT);
    
    Obj_SetPosition(obj, x, y);
    Obj_SetSpeed(obj, speed);
    Obj_SetAngle(obj, angle);
    ObjShot_SetGraphic(obj, graphic);
    ObjShot_SetDelay(obj, delay);
    
    loop(delay){ yield; }
    
    while(!Obj_BeDeleted(obj)) {
        if(Obj_GetX(obj)<GetClipMinX){
            Obj_SetX(obj, GetClipMinX*2 - Obj_GetX(obj));
            Obj_SetAngle(obj, 180 - Obj_GetAngle(obj));
	count--;
        }
        if(Obj_GetX(obj)>GetClipMaxX){
            Obj_SetX(obj, GetClipMaxX*2 - Obj_GetX(obj));
            Obj_SetAngle(obj, 180 - Obj_GetAngle(obj));
	count--;
        }
        if(Obj_GetY(obj)<GetClipMinY){
            Obj_SetY(obj, GetClipMinY*2 - Obj_GetY(obj));
            Obj_SetAngle(obj, 360 - Obj_GetAngle(obj));
	count--;
        }
  
        if(count<=0){ break; }
    
        yield;
    }
}

	@Finalize{
	DeleteGraphic(imgBoss);
	Delete;
	}

	#include_function ".\lib\lib_anime_Flandre.txt"
	#include_function ".\lib_Functions.txt"
}


script_enemy YUYUKO{
	let csd     = GetCurrentScriptDirectory;
	let shotData	=csd ~ "img\shot_All.txt";
	let imgBoss  = csd ~ "img\Boss\dot_yuyuko.png";

	@Initialize{
        SetLife(1);
	SetDamageRate(0, 0);
	InitializeAction();
	LoadUserShotData(shotData);
	LoadGraphic(imgBoss);
	Load;
	Main;
	}

	@MainLoop{
        SetCollisionA(GetX, GetY, 32);
        SetCollisionB(GetX, GetY, 16);
	yield;
	}

	@DrawLoop{
	SetColor(255,255,255);
	SetGraphicScale(1,1);
	SetAlpha(255);
	DrawBoss(imgBoss);
	}

task	Main{
	yield;
	wait(1740);
	standBy;
	Att;	
}

	sub standBy {
		SetMovePosition03(204, 140, 10, 7);
		SetAction(ACT_MOVE, 60);
		wait(120);
}

task Att{
	SetAction(ACT_SHOT_A, 420);
	shotA;
	shotB;
	shotC;
	shotD;
	wait(450);
	SetAngle(-45);
	SetSpeed(6);
	SetAction(ACT_MOVE, 240);
}

task shotA{
	let A=0;
	loop(16){
	let angle=0;
	while(angle<360){
	CreateShotA(1, GetX, GetY, 0);
	SetShotDataA(1, 0, 1.5, angle+A, 0.5, 0, 1, 105);
	SetShotDataA(1, 240, 1.5, NULL, 0.3, 0, 1, 105);
	FireShot(1);
	angle+=30;
	}
	A+=2;
	wait(30);
	}
}

task shotB{
	let A=0;
	loop(16){
	let angle=0;
	while(angle<360){
	CreateShotA(1, GetX, GetY, 0);
	SetShotDataA(1, 0, 1.5, angle+A, -0.5, 0, 1, 110);
	SetShotDataA(1, 240, 1.5, NULL, -0.3, 0, 1, 110);
	FireShot(1);
	angle+=30;
	}
	A+=2;
	wait(30);
	}
}

task shotC{
	let A=0;
	loop(16){
	let angle=0;
	while(angle<360){
	CreateShotA(1, GetX, GetY, 0);
	SetShotDataA(1, 0, 1.5, angle+A, 0, 0, 1, 108);
	SetShotDataA(1, 60, 1.5, NULL, -0.3, 0, 1, 108);
	FireShot(1);
	angle+=30;
	}
	A+=2;
	wait(30);
	}
}

task shotD{
	let A=0;
	loop(16){
	let angle=0;
	while(angle<360){
	CreateShotA(1, GetX, GetY, 0);
	SetShotDataA(1, 0, 1.5, angle+A, 0, 0, 1, 107);
	SetShotDataA(1, 60, 1.5, NULL, 0.3, 0, 1, 107);
	FireShot(1);
	angle+=30;
	}
	A+=2;
	wait(30);
	}
}

	@Finalize{
	DeleteGraphic(imgBoss);
	Delete;
	}

	#include_function ".\lib\lib_anime_Yuyuko.txt"
	#include_function ".\lib_Functions.txt"
}


script_enemy YOUMU{
	let csd     = GetCurrentScriptDirectory;
	let shotData	=csd ~ "img\shot_All.txt";
	let imgBoss  = csd ~ "img\Boss\dot_youmu.png";

	@Initialize{
        SetLife(1);
	SetDamageRate(0, 0);
	InitializeAction();
	LoadUserShotData(shotData);
	LoadGraphic(imgBoss);
	Load;
	Main;
	}

	@MainLoop{
        SetCollisionA(GetX, GetY, 32);
        SetCollisionB(GetX, GetY, 16);
	yield;
	}

	@DrawLoop{
	SetColor(255,255,255);
	SetGraphicScale(1,1);
	SetAlpha(255);
	DrawBoss(imgBoss);
	}

task	Main{
	yield;
	wait(1800);
	standBy;
	Att;	
}

	sub standBy {
		SetMovePosition03(284, 240, 10, 7);
		SetAction(ACT_MOVE, 60);
		wait(120);
}

task Att{
	wait(30);
	SetAction(ACT_SPELL, 240);
	wait(270);
	let y=GetPlayerY;
	SetMovePosition03(410, y, 12, 8);
	SetAction(ACT_MOVE, 30);
	wait(30);
	SetAction(ACT_CHARGE, 30);
	wait(30);
	CreateLaser01(GetX, GetY, 80, 180, 800, 10, BLUE01, 0);
	SetMovePosition02(42, y, 10);
	SetAction(ACT_SLASH_H, 30);
	wait(60);
	SetAngle(180);
	SetSpeed(6);
	SetAction(ACT_MOVE_L, 240);
}

	@Finalize{
	DeleteGraphic(imgBoss);
	Delete;
	}

	#include_function ".\lib\lib_anime_Youmu.txt"
	#include_function ".\lib_Functions.txt"
}