task Vanish{
let X=GetCommonData("EnemyX");
let Y=GetCommonData("EnemyY");
let Img1="script\img-System\EffectSet-1.png";
let rect01=32;
let rect02=128;
let rect03=63;
let rect04=159;
let Layer=5;
let W=(rect03-rect01)/2;
let H=(rect04-rect02)/2;
let Angle1=0;
let Angle2=40;
let Angle3=40;
let Scale=1;
let Frame1=0;
let Set1=0;
let Set2=0;
let Set3=0;
let Set4=0;
let Set5=0;
let Angle2=rand(0,180)+40;
let Angle3=rand(0,180)+40;
let Alpha=255;
let Obj=Obj_Create(OBJ_EFFECT);
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(6){
Vanishleaf1;
}
loop{
Frame1++;
Angle1++;
Angle2++;
Angle3++;
ObjEffect_SetScale(Obj,Scale,Scale);
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(Scale>20){	
}else{
Scale+=0.3;
}
if(Alpha<0){
Obj_Delete(Obj);
break;
}else{
Alpha-=8;
}
if(Frame1==60){
Obj_Delete(Obj);
break;	
}
yield;	
}
}
task Vanishleaf1{
let X=GetCommonData("EnemyX");
let Y=GetCommonData("EnemyY");
let Img1="script\img-System\EffectSet-1.png";
let rect01=0;
let rect02=128;
let rect03=31;
let rect04=159;
let Layer=5;
let W=(rect03-rect01)/2;
let H=(rect04-rect02)/2;
let Angle1=0;
let Angle2=40;
let Angle3=40;
let Scale=1;
let Frame1=0;
let Set1=0;
let Set2=0;
let Set3=0;
let Set4=0;
let Set5=0;
let Angle2=rand(0,180)+40;
let Angle3=rand(0,180)+40;
let Alpha=255;
let Obj=Obj_Create(OBJ_EFFECT);
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);
Obj_SetSpeed(Obj,rand(6,10));
Obj_SetAngle(Obj,rand(0,360));
Angle1=rand(0,360);
loop{
Frame1++;
Angle1+=5;
ObjEffect_SetAngle(Obj,Angle1,Angle1,Angle1);
ObjEffect_SetScale(Obj,Scale,Scale);
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(Scale>4){	
}else{
Scale+=0.1;
}
if(Alpha<0){
Obj_Delete(Obj);
break;
}else{
Alpha-=5;
}
if(Frame1==60){
Obj_Delete(Obj);
break;	
}
yield;	
}
}
task Item1UP{
let X=GetCommonData("EnemyX");
let Y=GetCommonData("EnemyY");
let img1="script\img-System\Item.png";
let X2=0;
let Y2=0;
let X3=0;
let Y3=0;
let X4=0;
let Y4=0;
let X5=0;
let Y5=0;
let rect01=41;
let rect02=15;
let rect03=58;
let rect04=32;
let Layer=4;
let scale=0;
let Sichi=false;
let W=(rect03-rect01)/2;
let H=(rect04-rect02)/2;
let frame=0;
let angle=200;
let dame=false;
let obj = Obj_Create(OBJ_EFFECT);
LoadGraphic(img1);
ObjEffect_SetTexture(obj,img1);
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
ObjEffect_CreateVertex(obj, 4);
ObjEffect_SetLayer(obj,Layer);
Obj_SetPosition(obj,rand(X-40,X+40),rand(Y-30,Y+30));
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);
Obj_SetAngle(obj,-90);
Obj_SetSpeed(obj,1);
loop{
frame++;
if(angle==0){
}else{
angle-=5;
}
if(scale>1){
}else{
scale+=0.1;
}
if(Sichi==true){
if(scale<0){
}else{
scale-=0.05;
}
}
ObjEffect_SetAngle(obj,0,0,angle);
ObjEffect_SetScale(obj,scale,scale);
X2=Obj_GetX(obj);
Y2=Obj_GetY(obj);
X3=Obj_GetX(obj);
Y3=Obj_GetY(obj);
X2 -=20;
Y2 -=20;
X3 +=20;
Y3 +=20;
if(GetPlayerX <X3){
if(GetPlayerX >X2){
if(GetPlayerY >Y2){
if(GetPlayerY <Y3){
PlaySE("script\SE\Extend.wav");
Sichi=true;
AddScore(100);
ExtendPlayer(1);
Obj_Delete(obj);
break;
}
}
}
}
X4=Obj_GetX(obj);
Y4=Obj_GetY(obj);
X5=Obj_GetX(obj);
Y5=Obj_GetY(obj);
X4 -=50;
Y4 -=50;
X5 +=50;
Y5 +=50;
if(GetPlayerX <X5){
if(GetPlayerX >X4){
if(GetPlayerY >Y4){
if(GetPlayerY <Y5){
Obj_SetSpeed(obj,15);//速度設定
let toAngle2=atan2(GetPlayerY-5-Obj_GetY(obj),GetPlayerX-Obj_GetX(obj));		
Obj_SetAngle(obj, toAngle2);
}
}
}
}
if(Obj_GetY(obj)>GetClipMaxY){
Obj_Delete(obj);
}
if(GetPlayerY <150){
dame=true;
}
if(dame==true){
Obj_SetSpeed(obj,15);//速度設定
let toAngle2=atan2(GetPlayerY-5-Obj_GetY(obj),GetPlayerX-Obj_GetX(obj));		
Obj_SetAngle(obj, toAngle2);
}
if(frame==5){
Obj_SetSpeed(obj,2);
}
if(frame==10){
Obj_SetSpeed(obj,3);
}
if(frame==15){
Obj_SetSpeed(obj,2);
}
if(frame==20){
Obj_SetSpeed(obj,1);
}
if(frame==30){
Obj_SetSpeed(obj,0.1);
}
if(frame==40){
if(dame==true){
}else{
Obj_SetAngle(obj,90);
}
Obj_SetSpeed(obj,1);
}
if(frame==50){
Obj_SetSpeed(obj,2);
}

yield;
}
}
task ItemBomb{
let X=GetCommonData("EnemyX");
let Y=GetCommonData("EnemyY");
let img1="script\img-System\Item.png";
let X2=0;
let Y2=0;
let X3=0;
let Y3=0;
let X4=0;
let Y4=0;
let X5=0;
let Y5=0;
let rect01=21;
let rect02=15;
let rect03=38;
let rect04=32;
let Layer=4;
let scale=0;
let Sichi=false;
let W=(rect03-rect01)/2;
let H=(rect04-rect02)/2;
let frame=0;
let angle=200;
let dame=false;
let obj = Obj_Create(OBJ_EFFECT);
LoadGraphic(img1);
ObjEffect_SetTexture(obj,img1);
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
ObjEffect_CreateVertex(obj, 4);
ObjEffect_SetLayer(obj,Layer);
Obj_SetPosition(obj,rand(X-40,X+40),rand(Y-30,Y+30));
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);
Obj_SetAngle(obj,-90);
Obj_SetSpeed(obj,1);
loop{
frame++;
if(angle==0){
}else{
angle-=5;
}
if(scale>1){
}else{
scale+=0.1;
}
if(Sichi==true){
if(scale<0){
}else{
scale-=0.05;
}
}
ObjEffect_SetAngle(obj,0,0,angle);
ObjEffect_SetScale(obj,scale,scale);
X2=Obj_GetX(obj);
Y2=Obj_GetY(obj);
X3=Obj_GetX(obj);
Y3=Obj_GetY(obj);
X2 -=20;
Y2 -=20;
X3 +=20;
Y3 +=20;
if(GetPlayerX <X3){
if(GetPlayerX >X2){
if(GetPlayerY >Y2){
if(GetPlayerY <Y3){
PlaySE("script\SE\ItemGet.wav");
Sichi=true;
AddScore(100);
AddBomb(1);
Obj_Delete(obj);
break;
}
}
}
}
X4=Obj_GetX(obj);
Y4=Obj_GetY(obj);
X5=Obj_GetX(obj);
Y5=Obj_GetY(obj);
X4 -=50;
Y4 -=50;
X5 +=50;
Y5 +=50;
if(GetPlayerX <X5){
if(GetPlayerX >X4){
if(GetPlayerY >Y4){
if(GetPlayerY <Y5){
Obj_SetSpeed(obj,15);//速度設定
let toAngle2=atan2(GetPlayerY-5-Obj_GetY(obj),GetPlayerX-Obj_GetX(obj));		
Obj_SetAngle(obj, toAngle2);
}
}
}
}
if(Obj_GetY(obj)>GetClipMaxY){
Obj_Delete(obj);
}
if(GetPlayerY <150){
dame=true;
}
if(dame==true){
Obj_SetSpeed(obj,15);//速度設定
let toAngle2=atan2(GetPlayerY-5-Obj_GetY(obj),GetPlayerX-Obj_GetX(obj));		
Obj_SetAngle(obj, toAngle2);
}
if(frame==5){
Obj_SetSpeed(obj,2);
}
if(frame==10){
Obj_SetSpeed(obj,3);
}
if(frame==15){
Obj_SetSpeed(obj,2);
}
if(frame==20){
Obj_SetSpeed(obj,1);
}
if(frame==30){
Obj_SetSpeed(obj,0.1);
}
if(frame==40){
if(dame==true){
}else{
Obj_SetAngle(obj,90);
}
Obj_SetSpeed(obj,1);
}
if(frame==50){
Obj_SetSpeed(obj,2);
}

yield;
}
}
task ItemBigPower{
let X=GetCommonData("EnemyX");
let Y=GetCommonData("EnemyY");
let img1="script\img-System\Item.png";
let X2=0;
let Y2=0;
let X3=0;
let Y3=0;
let X4=0;
let Y4=0;
let X5=0;
let Y5=0;
let rect01=1;
let rect02=15;
let rect03=18;
let rect04=32;
let Layer=4;
let scale=0;
let Sichi=false;
let W=(rect03-rect01)/2;
let H=(rect04-rect02)/2;
let frame=0;
let angle=200;
let dame=false;
let obj = Obj_Create(OBJ_EFFECT);
LoadGraphic(img1);
ObjEffect_SetTexture(obj,img1);
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
ObjEffect_CreateVertex(obj, 4);
ObjEffect_SetLayer(obj,Layer);
Obj_SetPosition(obj,rand(X-40,X+40),rand(Y-30,Y+30));
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);
Obj_SetAngle(obj,-90);
Obj_SetSpeed(obj,1);
loop{
frame++;
if(angle==0){
}else{
angle-=5;
}
if(scale>1){
}else{
scale+=0.1;
}
if(Sichi==true){
if(scale<0){
}else{
scale-=0.05;
}
}
ObjEffect_SetAngle(obj,0,0,angle);
ObjEffect_SetScale(obj,scale,scale);
X2=Obj_GetX(obj);
Y2=Obj_GetY(obj);
X3=Obj_GetX(obj);
Y3=Obj_GetY(obj);
X2 -=20;
Y2 -=20;
X3 +=20;
Y3 +=20;
if(GetPlayerX <X3){
if(GetPlayerX >X2){
if(GetPlayerY >Y2){
if(GetPlayerY <Y3){
PlaySE("script\SE\ItemGet.wav");
Sichi=true;
if(GetCommonData("Power")>400){
AddScore(200);
}else{
AddScore(100);
SetCommonData("Power",GetCommonData("Power")+20);
}
Obj_Delete(obj);
break;
}
}
}
}
X4=Obj_GetX(obj);
Y4=Obj_GetY(obj);
X5=Obj_GetX(obj);
Y5=Obj_GetY(obj);
X4 -=50;
Y4 -=50;
X5 +=50;
Y5 +=50;
if(GetPlayerX <X5){
if(GetPlayerX >X4){
if(GetPlayerY >Y4){
if(GetPlayerY <Y5){
Obj_SetSpeed(obj,15);//速度設定
let toAngle2=atan2(GetPlayerY-5-Obj_GetY(obj),GetPlayerX-Obj_GetX(obj));		
Obj_SetAngle(obj, toAngle2);
}
}
}
}
if(Obj_GetY(obj)>GetClipMaxY){
Obj_Delete(obj);
}
if(GetPlayerY <150){
dame=true;
}
if(dame==true){
Obj_SetSpeed(obj,15);//速度設定
let toAngle2=atan2(GetPlayerY-5-Obj_GetY(obj),GetPlayerX-Obj_GetX(obj));		
Obj_SetAngle(obj, toAngle2);
}
if(frame==5){
Obj_SetSpeed(obj,2);
}
if(frame==10){
Obj_SetSpeed(obj,3);
}
if(frame==15){
Obj_SetSpeed(obj,2);
}
if(frame==20){
Obj_SetSpeed(obj,1);
}
if(frame==30){
Obj_SetSpeed(obj,0.1);
}
if(frame==40){
if(dame==true){
}else{
Obj_SetAngle(obj,90);
}
Obj_SetSpeed(obj,1);
}
if(frame==50){
Obj_SetSpeed(obj,2);
}

yield;
}
}
task ItemPower{
let X=GetCommonData("EnemyX");
let Y=GetCommonData("EnemyY");
let img1="script\img-System\Item.png";
let X2=0;
let Y2=0;
let X3=0;
let Y3=0;
let X4=0;
let Y4=0;
let X5=0;
let Y5=0;
let rect01=1;
let rect02=1;
let rect03=15;
let rect04=15;
let Layer=4;
let scale=0;
let Sichi=false;
let W=(rect03-rect01)/2;
let H=(rect04-rect02)/2;
let frame=0;
let angle=200;
let dame=false;
let obj = Obj_Create(OBJ_EFFECT);
LoadGraphic(img1);
ObjEffect_SetTexture(obj,img1);
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
ObjEffect_CreateVertex(obj, 4);
ObjEffect_SetLayer(obj,Layer);
Obj_SetPosition(obj,rand(X-40,X+40),rand(Y-30,Y+30));
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);
Obj_SetAngle(obj,-90);
Obj_SetSpeed(obj,1);
loop{
frame++;
if(angle==0){
}else{
angle-=5;
}
if(scale>1){
}else{
scale+=0.1;
}
if(Sichi==true){
if(scale<0){
}else{
scale-=0.05;
}
}
ObjEffect_SetAngle(obj,0,0,angle);
ObjEffect_SetScale(obj,scale,scale);
X2=Obj_GetX(obj);
Y2=Obj_GetY(obj);
X3=Obj_GetX(obj);
Y3=Obj_GetY(obj);
X2 -=15;
Y2 -=15;
X3 +=15;
Y3 +=15;
if(GetPlayerX <X3){
if(GetPlayerX >X2){
if(GetPlayerY >Y2){
if(GetPlayerY <Y3){
PlaySE("script\SE\ItemGet.wav");
Sichi=true;
if(GetCommonData("Power")>400){
AddScore(100);
}else{
AddScore(50);
SetCommonData("Power",GetCommonData("Power")+5);
}
Obj_Delete(obj);
break;
}
}
}
}
X4=Obj_GetX(obj);
Y4=Obj_GetY(obj);
X5=Obj_GetX(obj);
Y5=Obj_GetY(obj);
X4 -=50;
Y4 -=50;
X5 +=50;
Y5 +=50;
if(GetPlayerX <X5){
if(GetPlayerX >X4){
if(GetPlayerY >Y4){
if(GetPlayerY <Y5){
Obj_SetSpeed(obj,15);//速度設定
let toAngle2=atan2(GetPlayerY-5-Obj_GetY(obj),GetPlayerX-Obj_GetX(obj));		
Obj_SetAngle(obj, toAngle2);
}
}
}
}
if(Obj_GetY(obj)>GetClipMaxY){
Obj_Delete(obj);
}
if(GetPlayerY <150){
dame=true;
}
if(dame==true){
Obj_SetSpeed(obj,15);//速度設定
let toAngle2=atan2(GetPlayerY-5-Obj_GetY(obj),GetPlayerX-Obj_GetX(obj));		
Obj_SetAngle(obj, toAngle2);
}
if(frame==5){
Obj_SetSpeed(obj,2);
}
if(frame==10){
Obj_SetSpeed(obj,3);
}
if(frame==15){
Obj_SetSpeed(obj,2);
}
if(frame==20){
Obj_SetSpeed(obj,1);
}
if(frame==30){
Obj_SetSpeed(obj,0.1);
}
if(frame==40){
if(dame==true){
}else{
Obj_SetAngle(obj,90);
}
Obj_SetSpeed(obj,1);
}
if(frame==50){
Obj_SetSpeed(obj,2);
}

yield;
}
}
task ItemPoint{
let X=GetCommonData("EnemyX");
let Y=GetCommonData("EnemyY");
let img1="script\img-System\Item.png";
let X2=0;
let Y2=0;
let X3=0;
let Y3=0;
let X4=0;
let Y4=0;
let X5=0;
let Y5=0;
let rect01=16;
let rect02=1;
let rect03=31;
let rect04=15;
let Layer=4;
let scale=0;
let Sichi=false;
let W=(rect03-rect01)/2;
let H=(rect04-rect02)/2;
let frame=0;
let angle=200;
let dame=false;
let obj = Obj_Create(OBJ_EFFECT);
LoadGraphic(img1);
ObjEffect_SetTexture(obj,img1);
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
ObjEffect_CreateVertex(obj, 4);
ObjEffect_SetLayer(obj,Layer);
Obj_SetPosition(obj,rand(X-40,X+40),rand(Y-30,Y+30));
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);
Obj_SetAngle(obj,-90);
Obj_SetSpeed(obj,1);
loop{
frame++;
if(angle==0){
}else{
angle-=5;
}
if(scale>1){
}else{
scale+=0.1;
}
if(Sichi==true){
if(scale<0){
}else{
scale-=0.05;
}
}
ObjEffect_SetAngle(obj,0,0,angle);
ObjEffect_SetScale(obj,scale,scale);
X2=Obj_GetX(obj);
Y2=Obj_GetY(obj);
X3=Obj_GetX(obj);
Y3=Obj_GetY(obj);
X2 -=15;
Y2 -=15;
X3 +=15;
Y3 +=15;
if(GetPlayerX <X3){
if(GetPlayerX >X2){
if(GetPlayerY >Y2){
if(GetPlayerY <Y3){
PlaySE("script\SE\ItemGet.wav");
Sichi=true;
AddScore(100);
AddPoint(1);
Obj_Delete(obj);
break;
}
}
}
}
X4=Obj_GetX(obj);
Y4=Obj_GetY(obj);
X5=Obj_GetX(obj);
Y5=Obj_GetY(obj);
X4 -=50;
Y4 -=50;
X5 +=50;
Y5 +=50;
if(GetPlayerX <X5){
if(GetPlayerX >X4){
if(GetPlayerY >Y4){
if(GetPlayerY <Y5){
Obj_SetSpeed(obj,15);//速度設定
let toAngle2=atan2(GetPlayerY-5-Obj_GetY(obj),GetPlayerX-Obj_GetX(obj));		
Obj_SetAngle(obj, toAngle2);
}
}
}
}
if(Obj_GetY(obj)>GetClipMaxY){
Obj_Delete(obj);
}
if(GetPlayerY <150){
dame=true;
}
if(dame==true){
Obj_SetSpeed(obj,15);//速度設定
let toAngle2=atan2(GetPlayerY-5-Obj_GetY(obj),GetPlayerX-Obj_GetX(obj));		
Obj_SetAngle(obj, toAngle2);
}
if(frame==5){
Obj_SetSpeed(obj,2);
}
if(frame==10){
Obj_SetSpeed(obj,3);
}
if(frame==15){
Obj_SetSpeed(obj,2);
}
if(frame==20){
Obj_SetSpeed(obj,1);
}
if(frame==30){
Obj_SetSpeed(obj,0.1);
}
if(frame==40){
if(dame==true){
}else{
Obj_SetAngle(obj,90);
}
Obj_SetSpeed(obj,1);
}
if(frame==50){
Obj_SetSpeed(obj,2);
}

yield;
}
}