
#Title[シアラ　スペル2]
#Text[]
#ScriptVersion[2]
#Player[script\script_Player\PlayerScript.txt]
script_enemy_main{
#include_function "script\Script-System\ThymeGauge2.txt"
#include_function "script\Script-System\Timer.txt"
#include_function "script\Script-System\LifeStar.txt"
#include_function "script\Script-System\LifeCircle.dms"
#include_function "script\Script-System\MagicCircle.txt"
#include_function "script\Script-System\ChargeEffect.txt"
SetCommonData("Player","Reimu");//保存時に消してください	
SetCommonData("OKShot",true);
let Frame1=0;
let Frame2=0;
let Cx=GetCenterX;
let Cy=GetCenterY;
let CutInSwitch=true;
let cutend=false;
let BossImage="script\Script-2Boss\Cerla-Dot.png";
let Anime1=0;let Anime2=0;let Anime3=0;let Anime4=0;let Height=0;
let MoveMord1=true; let BossShot=false;let MoveMord2=false;
let Frame1=0;let Frame2=0;let Frame3=0;let Frame4=0;let Frame5=0;
let Cx=GetCenterX; let Cy=GetCenterY; let Htime=0; let Move=true;
let Set1=0; let Set2=0; let Set3=0; let Set4=0;
let Angle1=0; let Angle2=0;
let NowBom=false;
let Bariaon=false;
@Initialize{
SetLife(1);
SetTimer(60);
SetDamageRate(100,100);
ThymeGauge1;
TimerBack;
SetEnemyMarker(true);
SetCommonData("SetStar",1);
SetCommonData("SetStarX",GetCenterX-185);
LifeStar1;
SetCommonData("BossNumber",2);
BossName;
LoadUserShotData("script\Script-System\AllShotData.txt");
SetGraphicRect(0,96,63,191);
LoadGraphic(BossImage);
SetMovePosition03(GetCenterX,150,10,4);
MoveMord1=true;
SetBossLifeCircle(3300,false,20,true);
BossMagicCircle;
}
			
@MainLoop{
yield;
Frame1++;Frame2++;Frame3++;Frame4++;Frame5++;
if(Frame1==60){
PlaySE("script\SE\SpellCard.wav");
Back1;
Back3;
Back2;
SpellEffect;
SpellLight;
BossCutIn;
SpellName;
}
SetCollisionA(GetX,GetY,25);SetCollisionB(GetX,GetY+Height,20);
if(Frame3==250){
Move=true;
if(Cx>GetX){
MoveMord1=true;
SetMovePosition03(rand(Cx,Cx+50),rand(100,200),10,3);
}
if(Cx<GetX){
MoveMord2=true;
SetMovePosition03(rand(Cx,Cx-50),rand(100,200),10,3);
}
Move=false;
Frame3=0;
}
if(Frame1==60){
Move=false;
Charge;
}

if(Frame1==200){
Move=false;
Charge;
}

if(Frame1==210){
PlaySE("script\SE\Laser1.wav");
Laser1;
if(Set2==1){
	
}else{
Frame1=188;
}
}
if(Frame2==400){
Set2=1;
}
if(Frame2==720){
Set2=0;
Frame1=200;
Frame2=200;
}




}
	
task Laser1{
let shot1=Obj_Create(OBJ_LASER);
let frame1=0;
let frame2=0;
let Set1=0;
let Set2=0;
let Set3=0;
let Set4=0;
let Set5=0;
let Nagasa=0;
let Hososa=0;
let Angle1=0;
Obj_SetX(shot1,GetX);//x座標設定
Obj_SetY(shot1,GetY);//y座標設定;
ObjShot_SetDelay(shot1,40);
ObjShot_SetGraphic(shot1,51);//画像設定
ObjLaser_SetSource(shot1,true);
Obj_SetAngle(shot1,rand(-0,-180));
loop{
frame1++;
frame2++;
ObjLaser_SetLength(shot1,Nagasa);
ObjLaser_SetWidth(shot1,Hososa);
Obj_SetX(shot1,GetX);
Obj_SetY(shot1,GetY);
if(frame1==80){
ObjShot_SetDelay(shot1,10);
}
if(frame1==100){
PlaySE("script\SE\Kira1.wav");
SetCommonData("Angle",Obj_GetAngle(shot1));
Shot1;
Shot2;
if(Set4==1){
	
}else{
frame1=95;
}
}
if(frame2==220){
ObjShot_FadeDelete(shot1);
return;
Obj_Delete(shot1);
}


if(Nagasa>1000){	
}else{
Nagasa+=15;
}
if(Hososa>16){	
}else{
Hososa+=1;
}
yield;
}
}
task Shot1{
let shot1=Obj_Create(OBJ_SHOT);
let count=0;
let frame1=0;
let X1=0;
let X2=0;
let Y1=0;
let Y2=0;
let Angle1=0;
Obj_SetX(shot1,GetX);//x座標設定
Obj_SetY(shot1,GetY);//y座標設定;
ObjShot_SetDelay(shot1,10);
Obj_SetSpeed(shot1,10);//速度設定
ObjShot_SetGraphic(shot1,1);//画像設定
Obj_SetAngle(shot1,GetCommonData("Angle"));
loop{
if(count==0){
if(Obj_GetX(shot1)<GetClipMinX){
PlaySE("script\SE\Kira1.wav");
ObjShot_SetGraphic(shot1,22);
Obj_SetSpeed(shot1,2);
Obj_SetX(shot1,GetClipMinX*2-Obj_GetX(shot1));
Angle1=Obj_GetAngle(shot1);
Angle1-=rand(-130,-230);
Obj_SetAngle(shot1,Angle1);
count++;
}
if(Obj_GetX(shot1)>GetClipMaxX){
PlaySE("script\SE\Kira1.wav");
ObjShot_SetGraphic(shot1,22);
Obj_SetSpeed(shot1,2);
Obj_SetX(shot1,GetClipMaxX*2-Obj_GetX(shot1));
Angle1=Obj_GetAngle(shot1);
Angle1-=rand(-130,-230);
Obj_SetAngle(shot1,Angle1);
count++;
}
if(Obj_GetY(shot1)<GetClipMinY){
PlaySE("script\SE\Kira1.wav");
ObjShot_SetGraphic(shot1,22);
Obj_SetSpeed(shot1,2);
Obj_SetY(shot1,GetClipMinY*2-Obj_GetY(shot1));
Angle1=Obj_GetAngle(shot1);
Angle1-=rand(-130,-230);
Obj_SetAngle(shot1,Angle1);
count++;
}
if(Obj_GetY(shot1)>GetClipMaxY){
PlaySE("script\SE\Kira1.wav");
ObjShot_SetGraphic(shot1,22);
Obj_SetSpeed(shot1,2);
Obj_SetY(shot1,GetClipMaxY*2-Obj_GetY(shot1));
Angle1=Obj_GetAngle(shot1);
Angle1-=rand(-130,-230);
Obj_SetAngle(shot1,Angle1);
count++;
}
}
yield;
}
}	
task Shot2{
let shot1=Obj_Create(OBJ_SHOT);
let count=0;
let frame1=0;
let X1=0;
let X2=0;
let Y1=0;
let Y2=0;
let Angle1=0;
Obj_SetX(shot1,GetX);//x座標設定
Obj_SetY(shot1,GetY);//y座標設定;
ObjShot_SetDelay(shot1,10);
Obj_SetSpeed(shot1,10);//速度設定
ObjShot_SetGraphic(shot1,1);//画像設定
Obj_SetAngle(shot1,GetCommonData("Angle"));
loop{
if(count==0){
if(Obj_GetX(shot1)<GetClipMinX){
PlaySE("script\SE\Kira1.wav");
ObjShot_SetGraphic(shot1,29);
Obj_SetSpeed(shot1,1.7);
Obj_SetX(shot1,GetClipMinX*2-Obj_GetX(shot1));
Angle1=atan2(GetPlayerY-Obj_GetY(shot1),GetPlayerX-Obj_GetX(shot1));
Obj_SetAngle(shot1,rand(Angle1-10,Angle1+10));
count++;
}
if(Obj_GetX(shot1)>GetClipMaxX){
PlaySE("script\SE\Kira1.wav");
ObjShot_SetGraphic(shot1,29);
Obj_SetSpeed(shot1,1.7);
Obj_SetX(shot1,GetClipMaxX*2-Obj_GetX(shot1));
Angle1=atan2(GetPlayerY-Obj_GetY(shot1),GetPlayerX-Obj_GetX(shot1));
Obj_SetAngle(shot1,rand(Angle1-10,Angle1+10));
count++;
}
if(Obj_GetY(shot1)<GetClipMinY){
PlaySE("script\SE\Kira1.wav");
ObjShot_SetGraphic(shot1,29);
Obj_SetSpeed(shot1,1.7);
Obj_SetY(shot1,GetClipMinY*2-Obj_GetY(shot1));
Angle1=atan2(GetPlayerY-Obj_GetY(shot1),GetPlayerX-Obj_GetX(shot1));
Obj_SetAngle(shot1,rand(Angle1-10,Angle1+10));
count++;
}
if(Obj_GetY(shot1)>GetClipMaxY){
PlaySE("script\SE\Kira1.wav");
ObjShot_SetGraphic(shot1,29);
Obj_SetSpeed(shot1,1.7);
Obj_SetY(shot1,GetClipMaxY*2-Obj_GetY(shot1));
Angle1=atan2(GetPlayerY-Obj_GetY(shot1),GetPlayerX-Obj_GetX(shot1));
Obj_SetAngle(shot1,rand(Angle1-10,Angle1+10));
count++;
}
}
yield;
}
}		
	
	
	
	
	
	
	
	
@DrawLoop{
SetTexture(BossImage);
DrawGraphic(GetX,GetY+Height);
Anime1++;
Anime2++;
Anime3++;
Anime4++;
if(GetSpeed<0.1){
if(MoveMord2==true){
if(Anime1==1){
SetGraphicRect(192,96,255,191);
} 
if(Anime1==5){
SetGraphicRect(128,96,191,191);
}
if(Anime1==10){
SetGraphicRect(64,96,127,191);
}
if(Anime1==15){
SetGraphicRect(0,96,63,191);
}
if(Anime1==20){
MoveMord2=false;
Anime1=0;
Anime2=0;
Anime4=0;
}
}else if(MoveMord1==true){
if(Anime1==1){
SetGraphicRect(192,192,255,287);
} 
if(Anime1==5){
SetGraphicRect(128,192,191,287);
}
if(Anime1==10){
SetGraphicRect(64,192,127,287);
}
if(Anime1==15){
SetGraphicRect(0,192,63,287);
}
if(Anime1==20){
MoveMord1=false;
Anime1=0;
Anime2=0;
}
}else{
 
if(BossShot==true){
if(Anime4==1){
SetGraphicRect(0,288,63,383);
}
if(Anime4==5){
SetGraphicRect(64,288,127,383);
} 
if(Anime4==10){
SetGraphicRect(128,288,191,383);
}
if(Anime4==15){
SetGraphicRect(192,288,255,383);
}
}else{
Anime2=0;
Anime3=0;
Anime4=0;
if(Anime1==1){
SetGraphicRect(0,0,63,95);
}
if(Anime1==10){
SetGraphicRect(64,0,127,95);
}
if(Anime1==20){
SetGraphicRect(128,0,191,95);
}
if(Anime1==30){
SetGraphicRect(192,0,255,95);
}
if(Anime1==40){
SetGraphicRect(128,0,191,95);
}
if(Anime1==50){
SetGraphicRect(64,0,127,95);
Anime1=0;
}
}
}
}else if(GetSpeedX<0){
Anime1=0;
Anime3=0;
Anime4=0;
if(Anime2==1){
SetGraphicRect(0,96,63,191);
}
if(Anime2==5){
SetGraphicRect(64,96,127,191);
}
if(Anime2==10){
SetGraphicRect(128,96,191,191);
}
if(Anime2==15){
SetGraphicRect(192,96,255,191);
}
}else{
Anime1=0;
Anime2=0;
Anime4=0;
if(Anime3==1){
SetGraphicRect(0,192,63,287);
} 
if(Anime3==5){
SetGraphicRect(64,192,127,287);
}
if(Anime3==10){
SetGraphicRect(128,192,191,287);
}
if(Anime3==15){
SetGraphicRect(192,192,255,287);
}

}
if(Move==false){
Htime++;
}
if(Htime==1){
Height+=1;
}
if(Htime==10){
Height+=1;
}
if(Htime==20){
Height+=1;
}
if(Htime==30){
Height-=1;
}
if(Htime==40){
Height-=1;
}
if(Htime==50){
Height-=1;
Htime=0;
}
}
			
@Finalize{
SetCommonData("EnemyX",GetX);
SetCommonData("EnemyY",GetY);
SetCommonData("SamonPoint",true);
SetCommonData("SamonPower",true);
SetCommonData("SamonBigPower",true);
}
task SpellLight{
let X=GetCenterX;
let Y=GetCenterY;
let img1="script\img-System\SpellEffectLight.png";
let rect01=0;
let rect02=0;
let rect03=384;
let rect04=448;
let Layer=6;
let W=(rect03-rect01)/2;
let H=(rect04-rect02)/2;
let alpha=0;
let alpha2=0;
let angle=180;
let frame1=0;
let set=0;
let obj = Obj_Create(OBJ_EFFECT);
if(Obj_BeDeleted(obj)==false){
LoadGraphic(img1);
ObjEffect_SetTexture(obj,img1);
ObjEffect_SetRenderState(obj,ADD);
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
ObjEffect_CreateVertex(obj, 4);
ObjEffect_SetLayer(obj,Layer);
Obj_SetPosition(obj, X, Y);
ObjEffect_SetAngle(obj,0,0,0);
ObjEffect_SetScale(obj,1.0,1.0);
ObjEffect_SetVertexXY(obj, 0,-W,-H);ObjEffect_SetVertexXY(obj, 1, W,-H);
ObjEffect_SetVertexXY(obj, 2, W, H);ObjEffect_SetVertexXY(obj, 3,-W, H);
ObjEffect_SetVertexUV(obj, 0, rect01, rect02);ObjEffect_SetVertexUV(obj, 1, rect03, rect02);
ObjEffect_SetVertexUV(obj, 2, rect03, rect04);ObjEffect_SetVertexUV(obj, 3, rect01, rect04);
ObjEffect_SetVertexColor(obj, 0, 255, 255, 255, 255);ObjEffect_SetVertexColor(obj, 1, 255, 255, 255, 255);
ObjEffect_SetVertexColor(obj, 2, 255, 255, 255, 255);ObjEffect_SetVertexColor(obj, 3, 255, 255, 255, 255);
loop{
if(alpha>255){set=1;}
if(alpha<0){set=0;}
if(set==1){alpha-=10;}else{alpha+=10;}
if(angle<0){	}else{angle-=3;}
if(cutend==true){frame1++;}else{}
ObjEffect_SetVertexColor(obj, 0, alpha, 255, 255, 255);ObjEffect_SetVertexColor(obj, 1, alpha, 255, 255, 255);
ObjEffect_SetVertexColor(obj, 2, alpha, 255, 255, 255);ObjEffect_SetVertexColor(obj, 3, alpha, 255, 255, 255);
if(frame1==1){set=1;}
if(frame1==5){}
if(frame1==20){Obj_Delete(obj);break;}
yield;
}
}
}
task SpellEffect{
let X=GetCenterX;
let Y=GetCenterY;
let img1="script\img-System\SpellEffect.png";
let rect01=0;
let rect02=0;
let rect03=384;
let rect04=448;
let Layer=6;
let W=(rect03-rect01)/2;
let H=(rect04-rect02)/2;
let alpha=0;
let alpha2=0;
let angle=180;
let frame1=0;
let set=0;
let obj = Obj_Create(OBJ_EFFECT);
if(Obj_BeDeleted(obj)==false){
LoadGraphic(img1);
ObjEffect_SetTexture(obj,img1);
ObjEffect_SetRenderState(obj,ALPHA);
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
ObjEffect_CreateVertex(obj, 4);
ObjEffect_SetLayer(obj,Layer);
Obj_SetPosition(obj, X, Y);
ObjEffect_SetAngle(obj,0,0,0);
ObjEffect_SetScale(obj,1.0,1.0);
ObjEffect_SetVertexXY(obj, 0,-W,-H);ObjEffect_SetVertexXY(obj, 1, W,-H);
ObjEffect_SetVertexXY(obj, 2, W, H);ObjEffect_SetVertexXY(obj, 3,-W, H);
ObjEffect_SetVertexUV(obj, 0, rect01, rect02);ObjEffect_SetVertexUV(obj, 1, rect03, rect02);
ObjEffect_SetVertexUV(obj, 2, rect03, rect04);ObjEffect_SetVertexUV(obj, 3, rect01, rect04);
ObjEffect_SetVertexColor(obj, 0, 255, 255, 255, 255);ObjEffect_SetVertexColor(obj, 1, 255, 255, 255, 255);
ObjEffect_SetVertexColor(obj, 2, 255, 255, 255, 255);ObjEffect_SetVertexColor(obj, 3, 255, 255, 255, 255);
loop{
if(alpha>255){set=1;}
if(alpha<0){set=0;}
if(set==1){}else{alpha+=6;}
if(angle<0){	}else{angle-=3;}
if(cutend==true){frame1++;alpha2-=10;
ObjEffect_SetVertexColor(obj, 0, alpha2, 255, 255, 255);ObjEffect_SetVertexColor(obj, 1, alpha2, 255, 255, 255);
ObjEffect_SetVertexColor(obj, 2, alpha2, 255, 255, 255);ObjEffect_SetVertexColor(obj, 3, alpha2, 255, 255, 255);}else{
ObjEffect_SetVertexColor(obj, 0, alpha, 255, 255, 255);ObjEffect_SetVertexColor(obj, 1, alpha, 255, 255, 255);
ObjEffect_SetVertexColor(obj, 2, alpha, 255, 255, 255);ObjEffect_SetVertexColor(obj, 3, alpha, 255, 255, 255);
}if(frame1==1){alpha2=alpha;}if(frame1==5){}
if(frame1==20){Obj_Delete(obj);break;}yield;
}
}
}
task BossCutIn{
let X=Cx+180;
let Y=Cy-50;
let rect01=1;
let rect02=1;
let rect03=450;
let rect04=612;
let img1="script\img-Character\Cerla-1.png";
let Layer=6;
let W=(rect03-rect01)/2;
let H=(rect04-rect02)/2;
let frame1=0;
let set1=0;
let obj = Obj_Create(OBJ_EFFECT);
LoadGraphic(img1);
ObjEffect_SetTexture(obj,img1);
ObjEffect_SetRenderState(obj,ALPHA);
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
ObjEffect_CreateVertex(obj, 4);
ObjEffect_SetLayer(obj,Layer);
Obj_SetPosition(obj, X, Y);
ObjEffect_SetAngle(obj,0,0,0);
ObjEffect_SetScale(obj,1.0,1.0);
ObjEffect_SetVertexXY(obj, 0,-W,-H);ObjEffect_SetVertexXY(obj, 1, W,-H);
ObjEffect_SetVertexXY(obj, 2, W, H);ObjEffect_SetVertexXY(obj, 3,-W, H);
ObjEffect_SetVertexUV(obj, 0, rect01, rect02);ObjEffect_SetVertexUV(obj, 1, rect03, rect02);
ObjEffect_SetVertexUV(obj, 2, rect03, rect04);ObjEffect_SetVertexUV(obj, 3, rect01, rect04);
ObjEffect_SetVertexColor(obj, 0, 255, 255, 255, 255);ObjEffect_SetVertexColor(obj, 1, 255, 255, 255, 255);
ObjEffect_SetVertexColor(obj, 2, 255, 255, 255, 255);ObjEffect_SetVertexColor(obj, 3, 255, 255, 255, 255);
loop{
frame1++;
if(frame1==5){PlaySE("script\SE\SpellCut.wav");Obj_SetAngle(obj,150);Obj_SetSpeed(obj,10);}
if(frame1==10){Obj_SetSpeed(obj,8);}if(frame1==14){Obj_SetSpeed(obj,7);}
if(frame1==17){Obj_SetSpeed(obj,6);}if(frame1==19){Obj_SetSpeed(obj,5);}
if(frame1==21){Obj_SetSpeed(obj,4);}if(frame1==24){Obj_SetSpeed(obj,3);}
if(frame1==26){Obj_SetSpeed(obj,2);}if(frame1==27){Obj_SetSpeed(obj,1);}
if(frame1==28){Obj_SetSpeed(obj,0.5);}if(frame1==90){Obj_SetSpeed(obj,2);}
if(frame1==95){Obj_SetSpeed(obj,3);}if(frame1==100){Obj_SetSpeed(obj,4);}
if(frame1==105){Obj_SetSpeed(obj,5);}if(frame1==110){Obj_SetSpeed(obj,6);}
if(frame1==115){Obj_SetSpeed(obj,7);}if(frame1==120){Obj_SetSpeed(obj,8);}
if(frame1==125){Obj_SetSpeed(obj,9);}if(frame1==130){Obj_SetSpeed(obj,16);}
if(frame1==145){cutend=true;}if(frame1==190){CutInSwitch=false;Obj_Delete(obj);break;}
yield;
}
}
task SpellName{
let X=Cx+64;
let Y=Cy+150;
let img1="script\Script-2Boss\Cerla-Spell05.png";
img1="script\Script-2Boss\Cerla-Spell05.png";
let rect01=0;
let rect02=0;
let rect03=256;
let rect04=40;
let Layer=6;
let W=(rect03-rect01)/2;
let H=(rect04-rect02)/2;
let frame1=0;
let scale=2;
let set1=0;
let obj = Obj_Create(OBJ_EFFECT);
LoadGraphic(img1);
ObjEffect_SetTexture(obj,img1);
ObjEffect_SetRenderState(obj,ALPHA);
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
ObjEffect_CreateVertex(obj, 4);
ObjEffect_SetLayer(obj,Layer);
Obj_SetPosition(obj, X, Y);
ObjEffect_SetAngle(obj,0,0,0);
ObjEffect_SetScale(obj,1.0,1.0);
ObjEffect_SetVertexXY(obj, 0,-W,-H);
ObjEffect_SetVertexXY(obj, 1, W,-H);
ObjEffect_SetVertexXY(obj, 2, W, H);
ObjEffect_SetVertexXY(obj, 3,-W, H);
ObjEffect_SetVertexUV(obj, 0, rect01, rect02);
ObjEffect_SetVertexUV(obj, 1, rect03, rect02);
ObjEffect_SetVertexUV(obj, 2, rect03, rect04);
ObjEffect_SetVertexUV(obj, 3, rect01, rect04);
ObjEffect_SetVertexColor(obj, 0, 255, 255, 255, 255);
ObjEffect_SetVertexColor(obj, 1, 255, 255, 255, 255);
ObjEffect_SetVertexColor(obj, 2, 255, 255, 255, 255);
ObjEffect_SetVertexColor(obj, 3, 255, 255, 255, 255);
loop{
frame1++;
if(scale<1){}else{scale-=0.1;ObjEffect_SetScale(obj,scale,scale);}
if(frame1==5){Obj_SetAngle(obj,-90);Obj_SetSpeed(obj,0);}
if(frame1==60){Obj_SetSpeed(obj,1);}if(frame1==62){Obj_SetSpeed(obj,2);}if(frame1==64){Obj_SetSpeed(obj,3);}
if(frame1==66){Obj_SetSpeed(obj,4);}if(frame1==68){Obj_SetSpeed(obj,5);}
if(frame1==70){Obj_SetSpeed(obj,6);}if(frame1==72){Obj_SetSpeed(obj,7);}
if(frame1==74){Obj_SetSpeed(obj,8);}if(frame1==76){Obj_SetSpeed(obj,9);}
if(frame1==78){Obj_SetSpeed(obj,10);}if(frame1==100){Obj_SetSpeed(obj,5);}
if(frame1==102){Obj_SetSpeed(obj,4);}if(frame1==104){Obj_SetSpeed(obj,3);}
if(frame1==106){Obj_SetSpeed(obj,2);}if(frame1==108){Obj_SetSpeed(obj,1);}if(frame1==110){Obj_SetSpeed(obj,0);}
yield;
}
}
task Back1{
let X=Cx;
let Y=Cy;
let img1="script\Script-2Boss\Cerla-Back1.png";
let rect01=0;
let rect02=0;
let rect03=384;
let rect04=448;
let Layer=0;
let Alpha=0;
let Set=0;
let Collar=0;
let W=(rect03-rect01)/2;
let H=(rect04-rect02)/2;
let obj = Obj_Create(OBJ_EFFECT);
LoadGraphic(img1);
ObjEffect_SetTexture(obj,img1);
ObjEffect_SetRenderState(obj,ALPHA);
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
ObjEffect_CreateVertex(obj, 4);
ObjEffect_SetLayer(obj,Layer);
Obj_SetPosition(obj, X, Y);
ObjEffect_SetAngle(obj,0,0,0);
ObjEffect_SetVertexXY(obj, 0,-W,-H);
ObjEffect_SetVertexXY(obj, 1, W,-H);
ObjEffect_SetVertexXY(obj, 2, W, H);
ObjEffect_SetVertexXY(obj, 3,-W, H);
ObjEffect_SetVertexUV(obj, 0, rect01, rect02);
ObjEffect_SetVertexUV(obj, 1, rect03, rect02);
ObjEffect_SetVertexUV(obj, 2, rect03, rect04);
ObjEffect_SetVertexUV(obj, 3, rect01, rect04);
ObjEffect_SetVertexColor(obj, 0, 255, 255, 255, 255);
ObjEffect_SetVertexColor(obj, 1, 255, 255, 255, 255);
ObjEffect_SetVertexColor(obj, 2, 255, 255, 255, 255);
ObjEffect_SetVertexColor(obj, 3, 255, 255, 255, 255);
loop{

yield;
}
}
task Back2{
let X=Cx;
let Y=Cy;
let img1="script\Script-2Boss\Cerla-Back2.png";
let rect01=0;
let rect02=0;
let rect03=750;
let rect04=750;
let Layer=0;
let Alpha=255;
let Set=0;
let Collar=0;
let Scale=1;
let Set2=0;
let SetA=0;
let SetB=1;
let SetC=2;
let SetD=3;
let Frame1=0;
let W=(rect03-rect01)/2;
let H=(rect04-rect02)/2;
let obj = Obj_Create(OBJ_EFFECT);
LoadGraphic(img1);
ObjEffect_SetRenderState(obj,MULTIPLY);
ObjEffect_SetTexture(obj,img1);
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
ObjEffect_CreateVertex(obj, 4);
ObjEffect_SetLayer(obj,Layer);
Obj_SetPosition(obj, X, Y);
ObjEffect_SetAngle(obj,0,0,0);
ObjEffect_SetVertexXY(obj, 0,-W,-H);
ObjEffect_SetVertexXY(obj, 1, W,-H);
ObjEffect_SetVertexXY(obj, 2, W, H);
ObjEffect_SetVertexXY(obj, 3,-W, H);
ObjEffect_SetVertexUV(obj, 0, rect01, rect02);
ObjEffect_SetVertexUV(obj, 1, rect03, rect02);
ObjEffect_SetVertexUV(obj, 2, rect03, rect04);
ObjEffect_SetVertexUV(obj, 3, rect01, rect04);
ObjEffect_SetVertexColor(obj, 0, 255, 255, 255, 255);
ObjEffect_SetVertexColor(obj, 1, 255, 255, 255, 255);
ObjEffect_SetVertexColor(obj, 2, 255, 255, 255, 255);
ObjEffect_SetVertexColor(obj, 3, 255, 255, 255, 255);
loop{
rect01=0;
rect02=0;
rect03=750+Set2;
rect04=750+Set2;
W=(rect03-rect01)/2;
H=(rect04-rect02)/2;
ObjEffect_SetVertexColor(obj, 0, 250, 255, 255, Set2);
ObjEffect_SetVertexColor(obj, 1, 250, 255, Set2, 255);
ObjEffect_SetVertexColor(obj, 2, 250, Set2, 255, 255);
ObjEffect_SetVertexColor(obj, 3, 250, 255, Set2, 255);
ObjEffect_SetVertexXY(obj, 0,-W,-H);ObjEffect_SetVertexXY(obj, 1, W,-H);
ObjEffect_SetVertexXY(obj, 2, W, H);ObjEffect_SetVertexXY(obj, 3,-W, H);
ObjEffect_SetVertexUV(obj, 0, rect01, rect02);ObjEffect_SetVertexUV(obj, 1, rect03, rect02);
ObjEffect_SetVertexUV(obj, 2, rect03, rect04);ObjEffect_SetVertexUV(obj, 3, rect01, rect04);
Set2++;
if(Set2>1024){
Set2=0;
}
yield;
}
}
task Back3{
let X=Cx;
let Y=Cy;
let img1="script\Script-2Boss\Cerla-Back3.png";
let rect01=0;
let rect02=0;
let rect03=384;
let rect04=446;
let Layer=0;
let Alpha=255;
let Set=0;
let Collar=0;
let Scale=2;
let Set2=0;
let SetA=0;
let SetB=1;
let SetC=2;
let SetD=3;
let Frame1=0;
let W=(rect03-rect01)/2;
let H=(rect04-rect02)/2;
let obj = Obj_Create(OBJ_EFFECT);
LoadGraphic(img1);
ObjEffect_SetRenderState(obj,ADD);
ObjEffect_SetTexture(obj,img1);
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
ObjEffect_CreateVertex(obj, 4);
ObjEffect_SetLayer(obj,Layer);
Obj_SetPosition(obj, X, Y);
ObjEffect_SetAngle(obj,0,0,0);
ObjEffect_SetVertexXY(obj, 0,-W,-H);
ObjEffect_SetVertexXY(obj, 1, W,-H);
ObjEffect_SetVertexXY(obj, 2, W, H);
ObjEffect_SetVertexXY(obj, 3,-W, H);
ObjEffect_SetVertexUV(obj, 0, rect01, rect02);
ObjEffect_SetVertexUV(obj, 1, rect03, rect02);
ObjEffect_SetVertexUV(obj, 2, rect03, rect04);
ObjEffect_SetVertexUV(obj, 3, rect01, rect04);
ObjEffect_SetVertexColor(obj, 0, 150, 255, 255, 255);
ObjEffect_SetVertexColor(obj, 1, 150, 255, 255, 255);
ObjEffect_SetVertexColor(obj, 2, 150, 255, 255, 255);
ObjEffect_SetVertexColor(obj, 3, 150, 255, 255, 255);
loop{
ObjEffect_SetVertexColor(obj, 0, 150, 255, 255, Set2);
ObjEffect_SetVertexColor(obj, 1, 150, 255, Set2, 255);
ObjEffect_SetVertexColor(obj, 2, 150, Set2, 255, 255);
ObjEffect_SetVertexColor(obj, 3, 150, 255, Set2, 255);
Set2+=5;
yield;
}
}


}


