//#TouhouDanmakufu
#ScriptVersion[3]
#Title["Sp1"]
#Text[""]

//デフォルト弾画像をロード
#include"./Default_ShotConst.txt"
#include"./function_cutin.txt"
#include"./effect.txt"
#include"./Default_Effect.txt"
SetCommonData("data",0);
let ti=0;
let dam=0;
let cut = GetCurrentScriptDirectory ~ "KeCut.png" ;
let earth = GetCurrentScriptDirectory ~ "earth2.png" ;
let earth2 = GetCurrentScriptDirectory ~ "earth.png" ;
let cir = GetCurrentScriptDirectory ~ "circle.png" ;
let cr = GetCurrentScriptDirectory ~ "spell.png" ;
let sbg = GetCurrentScriptDirectory ~ "spbg.png" ;
let sbg2 = GetCurrentScriptDirectory ~ "spbg2.jpg" ;
let fo = GetCurrentScriptDirectory ~ "impact.ttf" ;
///

//SetPlayerInvincibilityFrame(41565);
///
let bg = GetCurrentScriptDirectory ~ "sp2.png" ;
let bg2 = GetCurrentScriptDirectory ~ "bg2.png" ;
let pow = GetCurrentScriptDirectory ~ "./Sounds/se_power1.wav" ;
let dec = GetCurrentScriptDirectory ~ "./Sounds/se_cat00.wav" ;
let cha = GetCurrentScriptDirectory ~ "./Sounds/se_ch00.wav" ;
let fault = GetCurrentScriptDirectory ~ "./Sounds/se_fault.wav" ;
let tana = GetCurrentScriptDirectory ~ "./Sounds/se_tan01.wav" ;
let bgam = GetCurrentScriptDirectory ~ "./Sounds/st.mp3" ;
let ki = GetCurrentScriptDirectory ~ "./Sounds/se_kira00.wav" ;
let don = GetCurrentScriptDirectory ~ "./Sounds/se_tan01.wav" ;
let don2 = GetCurrentScriptDirectory ~ "./Sounds/se_don00.wav" ;
let boo = GetCurrentScriptDirectory ~ "./Sounds/se_boon01.wav" ;
function wait(w){loop(w){yield;}}
//----------------------------------------------------
//グローバル変数宣言
//この位置で宣言した変数はスクリプト全体で有効です。
//ただしこの箇所での変数への代入は、定数以外の代入は行えません。
//(実行順序が保障されないため乱数などの使用はできません)
let af1=0;
let af2=0;
let af3=0;

//----------------------------------------------------
let objEnemy; //敵オブジェクト
let objPlayer; //自機オブジェクト
let frame = 0; //敵動作に使用するカウンタ(@MainLoopで1づつ増加させます)
let img=GetCurrentScriptDirectory ~ "KE.png";
//----------------------------------------------------
//敵の動作
//----------------------------------------------------



@Initialize
{objEnemy = ObjEnemy_Create(OBJ_ENEMY_BOSS);
animate;
	ObjEnemy_Regist(objEnemy);
InstallFont(fo);
move;
//SetStgFrame(0, 0, SCREEN_WIDTH, 500, 0,80);
	//自機オブジェクト取得
	objPlayer = GetPlayerObjectID();
LoadSound(cha);
LoadSound(don2);
LoadSound(tana);
LoadSound(boo);
LoadSound(fault);
LoadSound(pow);
LoadSound(dec);
LoadSound(bgam);
LoadSound(ki);
	//敵オブジェクトを生成し登録
		
	//ObjMove_SetDestAtWeight(objEnemy, -120, -120, 10,12);

	//敵画像の設定
	
	//座標(cx, 120)へ60フレームかけて移動する
	let cx = GetStgFrameWidth() / 2;//STGシーンの中心x座標を取得
	StarEffect(objEnemy,11232);
	end;
	back;
	yield;
ObjMove_SetDestAtWeight(objEnemy, 192, 190, 10,3);
}
let t=0;
let ff=0;
let ff2=0;

let gg=0;
let gg2=0;
let tt=0;

///////////
let h=0;

let asd=0;
let asd2=0;


task animate{

let dir;
let speed;

let time=0;
let timetrue=0;

while(!Obj_IsDeleted(objEnemy)){yield;
ObjPrim_SetTexture(objEnemy,img);
//ObjSprite2D_SetDestCenter(objEnemy);

ObjSprite2D_SetDestRect(objEnemy,-61.5,-83+5*sin(h),61.5,83+5*sin(h));

h+=6;
ObjRender_SetScaleXYZ(objEnemy,0.8,0.8,0);

dir=ObjMove_GetAngle(objEnemy);
speed=ObjMove_GetSpeed(objEnemy);

if(speed==0){
af1++;



if(af3==1){

time++;

if(time<130){
ObjSprite2D_SetSourceRect(objEnemy,378, 257, 512, 447);
}

if(time>=12+130 && af1<=24+130){
ObjSprite2D_SetSourceRect(objEnemy,518,257, 651, 447);
}
if(time>=25+130){
ObjSprite2D_SetSourceRect(objEnemy,378, 257, 512, 447);
}

time=0;



}else{

if(af1<15){
ObjSprite2D_SetSourceRect(objEnemy,11, 1, 147, 192);
}

if(af1>=30+120 && af1<=45+120){
ObjSprite2D_SetSourceRect(objEnemy,170,6, 305, 194);
}
if(af1>=46+120){
ObjSprite2D_SetSourceRect(objEnemy,317, 6, 453, 192);
}
if(af1>=62+120){
ObjSprite2D_SetSourceRect(objEnemy,170,6, 305, 194);
}


}

}


if(speed>0 && cos(dir)>0 ){
af2++;
if(af2>12){ObjRender_SetAngleY(objEnemy,0);
ObjSprite2D_SetSourceRect(objEnemy,11, 198, 146, 388);}

if(af2>24){ObjRender_SetAngleY(objEnemy,0);
ObjSprite2D_SetSourceRect(objEnemy,159, 215, 293, 403);}


if(af2>36){af1=0;}
}


if(speed>0 && cos(dir)<0 ){

af2++;
if(af2>12){ObjRender_SetAngleY(objEnemy,180);
ObjSprite2D_SetSourceRect(objEnemy,11, 198, 146, 388);}

if(af2>24){ObjRender_SetAngleY(objEnemy,180);
ObjSprite2D_SetSourceRect(objEnemy,159, 215, 293, 403);}

if(af2>36){af1=0;}
}





if(af1>75+120){af1=0;}









}


}let hhh=0;let alal=0;
task back{
PlaySE(fault);
TExplosionA(ObjMove_GetX(objEnemy),ObjMove_GetY(objEnemy),5,1);
TExplosionA(ObjMove_GetX(objEnemy),ObjMove_GetY(objEnemy),2,0.1);

let bg1q=ObjPrim_Create(OBJ_SPRITE_2D);
bax(bg1q);
ObjPrim_SetTexture(bg1q,sbg);
ObjSprite2D_SetSourceRect(bg1q,0,0,1600,900);
ObjRender_SetAlpha(bg1q,alal);
ObjSprite2D_SetDestCenter(bg1q);
ObjRender_SetPosition(bg1q,GetStgFrameWidth/2,230,0);



/////



////

task bax(vv){

while(!Obj_IsDeleted(vv)){
yield;
ObjRender_SetAlpha(bg1q,alal);

ObjRender_SetAngleZ(vv,hhh);
hhh+=0.1;
}
}

ObjRender_SetScaleXYZ(bg1q,0.8,0.8,0);

Obj_SetRenderPriorityI(bg1q,20);






let bg133=ObjPrim_Create(OBJ_SPRITE_2D);



ObjPrim_SetTexture(bg133,cir);
ObjSprite2D_SetSourceRect(bg133,0,0,128,127);

ObjSprite2D_SetDestCenter(bg133);

////

let bg1333=ObjPrim_Create(OBJ_SPRITE_2D);



ObjPrim_SetTexture(bg1333,cir);
ObjSprite2D_SetSourceRect(bg1333,0,0,128,127);

ObjSprite2D_SetDestCenter(bg1333);

let hh=0;

dd;
task dd{
while(!Obj_IsDeleted(bg133)){
yield;




ObjRender_SetPosition(bg133,ObjMove_GetX(objEnemy),ObjMove_GetY(objEnemy),0);
ObjRender_SetAngleZ(bg133,asd2/2);


ObjRender_SetScaleXYZ(bg133,1+sin(hh),1+sin(hh),0);
if(hh<180){hh+=0.5;}else{hh=0;}

Obj_SetRenderPriorityI(bg133,22);
ObjRender_SetAlpha(bg133,133);

//



ObjRender_SetPosition(bg1333,ObjMove_GetX(objEnemy),ObjMove_GetY(objEnemy),0);
ObjRender_SetAngleZ(bg1333,-asd2/2);


ObjRender_SetScaleXYZ(bg1333,1+sin(hh),1+sin(hh),0);


Obj_SetRenderPriorityI(bg1333,22);
ObjRender_SetAlpha(bg1333,133);


asd2+=6;}}


}




@Event
{
	alternative(GetEventType())
	case(EV_REQUEST_LIFE)
	{
		//敵ライフを要求された
		SetScriptResult(6300);//ライフを500に設定
	}
	case(EV_REQUEST_TIMER)
	{
		//敵ライフを要求された
		SetScriptResult(70);//ライフを500に設定
	}
}

let ang=0;
let ang2=0;
let al=0;
let al2=0;
let al23=0;
let sc=0;
let ann=0;

let dd=0;
let dd2=0;
let and=0;
let and2=0;

task fire2{wait(90);
task sccc{loop{yield;sc+=1;}}
sccc;
loop{PlaySE(ki);
loop(2){
let obj21=CreateShotA1(ObjMove_GetX(objEnemy)+50*cos(sc),ObjMove_GetY(objEnemy)+50*sin(sc), 1, dd+dd2, DS_STAR_S_PURPLE, 10);
let obj211=CreateShotA1(ObjMove_GetX(objEnemy)-50*cos(sc),ObjMove_GetY(objEnemy)-50*sin(sc), 1, dd+dd2, DS_STAR_S_PURPLE, 10);

dd+=360/2;
}
dd+=13.9667;
wait(7);

}
}



task fire{
fire2;

loop(15){


let obj27=CreateShotA1(ObjMove_GetX(objEnemy), ObjMove_GetY(objEnemy), 4, and+and2, DS_LIGHT_BLUE, 10);
let obj277=CreateShotA1(ObjMove_GetX(objEnemy), ObjMove_GetY(objEnemy), 4, and+and2+180, DS_LIGHT_BLUE, 10);

and+=360/15;
sto(obj27);
sto2(obj277);
}
task sto2(ik){
dam=2;
loop(30){
ObjMove_SetSpeed(ik,ObjMove_GetSpeed(ik)-0.4/3);
wait(3);

}}
task sto(ik){

loop(30){
ObjMove_SetSpeed(ik,ObjMove_GetSpeed(ik)-0.4/3);
wait(3);

}
let ann2=0;
loop{
//PlaySE(ki);

let obj277=CreateShotA1(ObjMove_GetX(ik), ObjMove_GetY(ik), 1.2, ObjMove_GetAngle(ik)-and, DS_BALL_SS_SKY, 10);
let obj2777=CreateShotA1(ObjMove_GetX(ik), ObjMove_GetY(ik), 1.2, ObjMove_GetAngle(ik)-and+120, DS_BALL_SS_SKY, 10);
let obj27777=CreateShotA1(ObjMove_GetX(ik), ObjMove_GetY(ik), 1.2, ObjMove_GetAngle(ik)-and+120+120, DS_BALL_SS_SKY, 10);

wait(20);
and+=-13.456546;
wait(25);
}





}











}

task chek{



wait(1800);
SetCommonData("data",1);
wait(120);
StarConcentration(objEnemy,90);
PlaySE(cha);
wait(200);
PlaySE(pow);
ti=1;
af3=1;
fire;




}



task eart{

chek;

let bg11=ObjPrim_Create(OBJ_SPRITE_2D);

ObjPrim_SetTexture(bg11,earth);





ObjSprite2D_SetSourceRect(bg11,0,0,250,200);

ObjSprite2D_SetDestCenter(bg11);
ObjRender_SetPosition(bg11,ObjMove_GetX(objEnemy),ObjMove_GetY(objEnemy),0);



ObjRender_SetScaleXYZ(bg11,sc,sc,0);

Obj_SetRenderPriorityI(bg11,29);
ObjRender_SetAlpha(bg11,155);


while(!Obj_IsDeleted(bg11)){
yield;

loop(65){
yield;
ObjRender_SetAngleZ(bg11,ann);
ann+=0.6;
ObjRender_SetScaleXYZ(bg11,sc,sc,0);
sc+=0.02;
}

break;
}


loop{yield;if(ti==0){
ObjRender_SetAngleZ(bg11,ann);
ann++;}
if(ti==1){break;}
}
//ObjRender_SetAlpha(bg11,210);

ObjPrim_SetTexture(bg11,earth2);
loop{yield;
ObjRender_SetAngleZ(bg11,ann);
ann++;}





}



task tex{

let ttt=ObjText_Create;



let bg1=ObjPrim_Create(OBJ_SPRITE_2D);

ObjPrim_SetTexture(bg1,cr);
ObjSprite2D_SetSourceRect(bg1,0,0,234,36);

ObjSprite2D_SetDestCenter(bg1);
ObjRender_SetPosition(bg1,-230+al2,SCREEN_HEIGHT-150,0);



ObjRender_SetScaleXYZ(bg1,1,1,0);

Obj_SetRenderPriorityI(bg1,29);
ObjRender_SetAlpha(bg1,255);


ObjRender_SetAlpha(ttt,al);
ObjText_SetFontSize(ttt,20);
ObjText_SetFontBorderType(ttt,BORDER_SHADOW);
ObjText_SetFontBorderWidth(ttt,2);
ObjText_SetFontBorderColor(ttt,0,0,0);
//ObjRender_SetPosition(ttt,-1111,SCREEN_HEIGHT-350,0);
ObjText_SetFontType(ttt,"Impact");
ObjText_SetText(ttt,"Earth sign '' Formation of the ozone shield ''");

task innn{
loop(60){al2+=3.95;ObjRender_SetPosition(bg1,55+al2,SCREEN_HEIGHT-150+10,0);
ObjRender_SetPosition(ttt,-230+al2,SCREEN_HEIGHT-150,0);
yield;}
wait(30);
loop(45){ObjRender_SetPosition(bg1,55+al2,SCREEN_HEIGHT-150-al23+10,0);
ObjRender_SetPosition(ttt,-230+al2,SCREEN_HEIGHT-150-al23,0);al23+=7;
yield;}

}


innn;
while(!Obj_IsDeleted(ttt)){
yield;
loop(120){

ObjRender_SetAlpha(ttt,al);al+=2;yield;}

break;
}



}

task things{
let fas=0;
let x=0;
let y=0;
let an=0;
//wait(180);
loop{
wait(60);
if(GetCommonData("data",1)){break;}else{

fas=rand(-12,12);
if(fas>0){x=-10;y=rand(50,GetStgFrameHeight-50);an=0+rand(-20,20);}
if(fas<0){x=GetStgFrameWidth+10;y=rand(50,GetStgFrameHeight-50);an=180-rand(-20,20);}


let obj22=CreateShotA1(x, y, rand(1,2),an, DS_BALL_BS_BLUE, 0);

pov;
task pov{
while(!Obj_IsDeleted(obj22)){
yield;
                                                                                                                                                                                                    // //////                                        

if(ObjMove_GetX(obj22)>ObjMove_GetX(objEnemy)-60 && ObjMove_GetX(obj22)<ObjMove_GetX(objEnemy)+60 && ObjMove_GetY(obj22)>ObjMove_GetY(objEnemy)-110 && ObjMove_GetY(obj22)<ObjMove_GetY(objEnemy)+110){
PlaySE(ki);
loop(10){
let obj9=CreateShotA1(ObjMove_GetX(obj22), ObjMove_GetY(obj22), 0.8,ang+ang2, DS_BALL_SS_BLUE, 10);
ang+=360/10;
}ang2+=16.345344;
Obj_Delete(obj22);
break;

}
if(ObjMove_GetX(obj22)>ObjMove_GetX(objEnemy)-90 && ObjMove_GetX(obj22)<ObjMove_GetX(objEnemy)+90 && ObjMove_GetY(obj22)>ObjMove_GetY(objEnemy)-80 && ObjMove_GetY(obj22)<ObjMove_GetY(objEnemy)+80){
PlaySE(ki);
loop(10){
let obj9=CreateShotA1(ObjMove_GetX(obj22), ObjMove_GetY(obj22), 0.8,ang+ang2, DS_BALL_SS_BLUE, 10);
ang+=360/10;
}ang2+=16.345344;
Obj_Delete(obj22);
break;

}
if(ObjMove_GetX(obj22)>ObjMove_GetX(objEnemy)-110 && ObjMove_GetX(obj22)<ObjMove_GetX(objEnemy)+110 && ObjMove_GetY(obj22)>ObjMove_GetY(objEnemy)-40 && ObjMove_GetY(obj22)<ObjMove_GetY(objEnemy)+40 ){
PlaySE(ki);
loop(10){
let obj9=CreateShotA1(ObjMove_GetX(obj22), ObjMove_GetY(obj22), 0.8,ang+ang2, DS_BALL_SS_BLUE, 10);
ang+=360/10;
}ang2+=16.345344;
Obj_Delete(obj22);
break;

}




}

}}

}

}
/////////

let ang3=0;
let ang33=0;
task things2{wait(180);
let fas=0;
let x=0;let spp=0.5;
let y=0;
let an=0;
wait(180);
loop{
wait(60);

if(GetCommonData("data",1)){break;}else{
fas=rand(-12,12);
if(fas>0){x=-10;y=rand(50,GetStgFrameHeight-50);an=0+rand(-20,20);}
if(fas<0){x=GetStgFrameWidth+10;y=rand(50,GetStgFrameHeight-50);an=180-rand(-20,20);}


let obj22=CreateShotA1(x, y, rand(1,2),an, DS_BALL_M_ORANGE, 10);

pov;
task pov{
while(!Obj_IsDeleted(obj22)){
yield;
                                                                                                                                                                                                    // //////                                        

if(ObjMove_GetX(obj22)>ObjMove_GetX(objEnemy)-60 && ObjMove_GetX(obj22)<ObjMove_GetX(objEnemy)+60 && ObjMove_GetY(obj22)>ObjMove_GetY(objEnemy)-110 && ObjMove_GetY(obj22)<ObjMove_GetY(objEnemy)+110){
PlaySE(don);
loop(20){
loop(5){
let obj9=CreateShotA1(ObjMove_GetX(obj22), ObjMove_GetY(obj22), spp*2,ang3+ang33, DS_BALL_S_ORANGE	, 10);

ang3+=360/5;
}ang33+=1.345344;spp-=0.001;}spp=0.5;
Obj_Delete(obj22);
break;

}
if(ObjMove_GetX(obj22)>ObjMove_GetX(objEnemy)-90 && ObjMove_GetX(obj22)<ObjMove_GetX(objEnemy)+90 && ObjMove_GetY(obj22)>ObjMove_GetY(objEnemy)-80 && ObjMove_GetY(obj22)<ObjMove_GetY(objEnemy)+80){
PlaySE(don);
loop(20){
loop(5){
let obj9=CreateShotA1(ObjMove_GetX(obj22), ObjMove_GetY(obj22), spp*2,ang3+ang33, DS_BALL_S_ORANGE	, 10);

ang3+=360/5;
}ang33+=1.345344;spp-=0.001;}spp=0.5;
Obj_Delete(obj22);

}
if(ObjMove_GetX(obj22)>ObjMove_GetX(objEnemy)-110 && ObjMove_GetX(obj22)<ObjMove_GetX(objEnemy)+110 && ObjMove_GetY(obj22)>ObjMove_GetY(objEnemy)-40 && ObjMove_GetY(obj22)<ObjMove_GetY(objEnemy)+40 ){
PlaySE(don);
loop(20){
loop(5){
let obj9=CreateShotA1(ObjMove_GetX(obj22), ObjMove_GetY(obj22), spp*2,ang3+ang33, DS_BALL_S_ORANGE	, 10);

ang3+=360/5;
}ang33+=1.345344;spp-=0.001;}spp=0.5;
Obj_Delete(obj22);

}




}

}}

}

}
//
/////////

let ang5=0;
let ang55=0;
task things3{wait(360);
let fas=0;
let x=0;let spp=0.5;
let y=0;
let an=0;
wait(180);
loop{
wait(60);

if(GetCommonData("data",1)){break;}else{
fas=rand(-12,12);
if(fas>0){x=-10;y=rand(50,GetStgFrameHeight-50);an=0+rand(-20,20);}
if(fas<0){x=GetStgFrameWidth+10;y=rand(50,GetStgFrameHeight-50);an=180-rand(-20,20);}


let obj22=CreateShotA1(x, y, rand(0.5,1.5),an, DS_BALL_L_RED, 10);

pov;
task pov{
while(!Obj_IsDeleted(obj22)){
yield;
                                                                                                                                                                                                    // //////                                        

if(ObjMove_GetX(obj22)>ObjMove_GetX(objEnemy)-60 && ObjMove_GetX(obj22)<ObjMove_GetX(objEnemy)+60 && ObjMove_GetY(obj22)>ObjMove_GetY(objEnemy)-110 && ObjMove_GetY(obj22)<ObjMove_GetY(objEnemy)+110){
PlaySE(don2);


loop(5){
let obj9=CreateShotA1(ObjMove_GetX(obj22), ObjMove_GetY(obj22), 1.4,ang5+ang55, DS_STAR_S_RED	, 10);
let obj91=CreateShotA1(ObjMove_GetX(obj22), ObjMove_GetY(obj22), 1.2,ang5+ang55+45, DS_STAR_S_RED	, 10);
let obj911=CreateShotA1(ObjMove_GetX(obj22), ObjMove_GetY(obj22), 1,ang5+ang55+90, DS_STAR_S_RED	, 10);
//
let objw9=CreateShotA1(ObjMove_GetX(obj22), ObjMove_GetY(obj22), 0.8,ang5+ang55, DS_STAR_S_RED	, 10);
let objw91=CreateShotA1(ObjMove_GetX(obj22), ObjMove_GetY(obj22), 0.6,ang5+ang55+45, DS_STAR_S_RED	, 10);
let objw911=CreateShotA1(ObjMove_GetX(obj22), ObjMove_GetY(obj22), 0.4,ang5+ang55+90, DS_STAR_S_RED	, 10);

ang5+=360/5;
}ang55+=1.345344;spp=0.5;

//192, 190
loop(20){
let obj9111=CreateShotA1(ObjMove_GetX(obj22), ObjMove_GetY(obj22), 1,ang5+ang55, DS_NEEDLE_RED	, 10);
ina(obj9111);
ang5+=360/20;
//ObjRender_SetScaleXYZ(obj9111,0.6,0.6,0);
}

task ina(o){
loop(10){
wait(4);
ObjMove_SetSpeed(o,ObjMove_GetSpeed(o)-0.1)


}
wait(60);
loop(60){
wait(4);
ObjMove_SetSpeed(o,ObjMove_GetSpeed(o)+0.05)


}
}


Obj_Delete(obj22);
break;

}
if(ObjMove_GetX(obj22)>ObjMove_GetX(objEnemy)-90 && ObjMove_GetX(obj22)<ObjMove_GetX(objEnemy)+90 && ObjMove_GetY(obj22)>ObjMove_GetY(objEnemy)-80 && ObjMove_GetY(obj22)<ObjMove_GetY(objEnemy)+80){
PlaySE(don2);


loop(5){
let obj9=CreateShotA1(ObjMove_GetX(obj22), ObjMove_GetY(obj22), 1.4,ang5+ang55, DS_STAR_S_RED	, 10);
let obj91=CreateShotA1(ObjMove_GetX(obj22), ObjMove_GetY(obj22), 1.2,ang5+ang55+45, DS_STAR_S_RED	, 10);
let obj911=CreateShotA1(ObjMove_GetX(obj22), ObjMove_GetY(obj22), 1,ang5+ang55+90, DS_STAR_S_RED	, 10);
//
let objw9=CreateShotA1(ObjMove_GetX(obj22), ObjMove_GetY(obj22), 0.8,ang5+ang55, DS_STAR_S_RED	, 10);
let objw91=CreateShotA1(ObjMove_GetX(obj22), ObjMove_GetY(obj22), 0.6,ang5+ang55+45, DS_STAR_S_RED	, 10);
let objw911=CreateShotA1(ObjMove_GetX(obj22), ObjMove_GetY(obj22), 0.4,ang5+ang55+90, DS_STAR_S_RED	, 10);

ang5+=360/5;
}ang55+=1.345344;spp=0.5;

//192, 190
loop(20){
let obj9111=CreateShotA1(ObjMove_GetX(obj22), ObjMove_GetY(obj22), 1,ang5+ang55, DS_NEEDLE_RED	, 10);
ina(obj9111);
ang5+=360/20;
//ObjRender_SetScaleXYZ(obj9111,0.6,0.6,0);
}

task ina(o){
loop(10){
wait(4);
ObjMove_SetSpeed(o,ObjMove_GetSpeed(o)-0.1)


}
wait(60);
loop(60){
wait(4);
ObjMove_SetSpeed(o,ObjMove_GetSpeed(o)+0.05)


}
}


Obj_Delete(obj22);
break;
}
if(ObjMove_GetX(obj22)>ObjMove_GetX(objEnemy)-110 && ObjMove_GetX(obj22)<ObjMove_GetX(objEnemy)+110 && ObjMove_GetY(obj22)>ObjMove_GetY(objEnemy)-40 && ObjMove_GetY(obj22)<ObjMove_GetY(objEnemy)+40 ){
PlaySE(don2);


loop(5){
let obj9=CreateShotA1(ObjMove_GetX(obj22), ObjMove_GetY(obj22), 1.4,ang5+ang55, DS_STAR_S_RED	, 10);
let obj91=CreateShotA1(ObjMove_GetX(obj22), ObjMove_GetY(obj22), 1.2,ang5+ang55+45, DS_STAR_S_RED	, 10);
let obj911=CreateShotA1(ObjMove_GetX(obj22), ObjMove_GetY(obj22), 1,ang5+ang55+90, DS_STAR_S_RED	, 10);
//
let objw9=CreateShotA1(ObjMove_GetX(obj22), ObjMove_GetY(obj22), 0.8,ang5+ang55, DS_STAR_S_RED	, 10);
let objw91=CreateShotA1(ObjMove_GetX(obj22), ObjMove_GetY(obj22), 0.6,ang5+ang55+45, DS_STAR_S_RED	, 10);
let objw911=CreateShotA1(ObjMove_GetX(obj22), ObjMove_GetY(obj22), 0.4,ang5+ang55+90, DS_STAR_S_RED	, 10);

ang5+=360/5;
}ang55+=1.345344;spp=0.5;

//192, 190
loop(20){
let obj9111=CreateShotA1(ObjMove_GetX(obj22), ObjMove_GetY(obj22), 1,ang5+ang55, DS_NEEDLE_RED	, 10);
ina(obj9111);
ang5+=360/20;
//ObjRender_SetScaleXYZ(obj9111,0.6,0.6,0);
}

task ina(o){
loop(10){
wait(4);
ObjMove_SetSpeed(o,ObjMove_GetSpeed(o)-0.1)


}
wait(60);
loop(60){
wait(4);
ObjMove_SetSpeed(o,ObjMove_GetSpeed(o)+0.05)


}
}


Obj_Delete(obj22);
break;
}




}

}}

}

}

/////

task move{
wait(120);
af3=1;
PlaySE(dec);
tex;
alal=130;
cutin(NAZRIN,cut,0,0,435,558);
wait(30);
af3=0;
wait(150);

PlaySE(cha);StarConcentration(objEnemy,90);
wait(120);
af3=1;
eart;
PlaySE(boo);
wait(60);things;dam=1;
af3=0;
things2;
things3;
}






@MainLoop
{yield;SetAutoDeleteObject(true);
	//敵の座標を取得
	let ex = ObjMove_GetX(objEnemy);
	let ey = ObjMove_GetY(objEnemy);

		let px = GetPlayerX();
		let py = GetPlayerY();

	
		let ATP = atan2(py - ey, px - ex);


	if(dam==0){ObjEnemy_SetDamageRate(objEnemy,0,0);}
	if(dam==1){ObjEnemy_SetDamageRate(objEnemy,30,5);}
	if(dam==2){ObjEnemy_SetDamageRate(objEnemy,120,5);}
	

	//当たり判定登録
	ObjEnemy_SetIntersectionCircleToShot(objEnemy, ex, ey, 32);//当たり判定(自機弾用)登録
	ObjEnemy_SetIntersectionCircleToShot(objEnemy, ex, ey+30, 32);//当たり判定(自機弾用)登録
	ObjEnemy_SetIntersectionCircleToPlayer(objEnemy, ex, ey, 32);//当たり判定(体当たり用)登録
	ObjEnemy_SetIntersectionCircleToPlayer(objEnemy, ex, ey+20, 32);//当たり判定(体当たり用)登録
	ObjEnemy_SetIntersectionCircleToPlayer(objEnemy, ex, ey-20, 32);//当たり判定(体当たり用)登録

	//カウンタに1追加
	frame++;
SetForbidPlayerSpell(true);
	//ライフ0処理
	
}




task end{
while(ObjEnemy_GetInfo(objEnemy,INFO_LIFE)>0){yield;}
Obj_Delete(objEnemy);
CloseScript(GetOwnScriptID);}
