#東方弾幕風[Player]
#ScriptVersion[2]
#Menu[決定キーでスタートしてください]
#Text[ゲームを開始します]
#Image[]
if(GetCommonData("Player")==Reimu){
#ReplayName[Reimu]
}
if(GetCommonData("Player")==Marisa){
#ReplayName[Marisa]
}
if(GetCommonData("Player")==Sakuya){
#ReplayName[Sakuya]
}
script_player_main{
SetCommonData("OKShot",false);
SetCommonData("Power",1);
let Cx=GetCenterX;
let Cy=GetCenterY;
let Csd = GetCurrentScriptDirectory;
let PlayerImg_Reimu=Csd~"Reimu-Dot.png";
let PlayerImg_Marisa=Csd~"Marisa-Dot.png";
let PlayerImg_Sakuya=Csd~"Sakuya-Dot.png";
let Img_HitBox=Csd~"hitbox.png";
let Anime1=0;
let Anime2=0;
let Anime3=0;
let Pow1=0;
let Pow2=0;
let Pow3=0;
let Pow4=0;
let ShotFrame1=0;
let ShotFrame2=0;
let ShotFrame3=0;
let Boxset=0;
 
@Initialize{
LoadGraphic(PlayerImg_Reimu);
LoadGraphic(PlayerImg_Marisa);
LoadGraphic(PlayerImg_Sakuya);
LoadGraphic(Img_HitBox);
LoadPlayerShotData("script\script_Player\ShotData.txt");
Option1;
Option2;
Option3;
Option4;
}
    
@MainLoop{
yield;
Anime1++;
Anime2++;
Anime3++;
if(GetCommonData("Player")=="Reimu"){//霊夢の場合は当たり判定を小さくする
SetIntersectionCircle(GetPlayerX,GetPlayerY,0.5);
}else{
SetIntersectionCircle(GetPlayerX,GetPlayerY,1);		
}
if(GetCommonData("Player")=="Reimu"){//自機による移動速度の変化を設定する
SetSpeed(4,1.5);
}
if(GetCommonData("Player")=="Marisa"){
SetSpeed(5,3);
}
if(GetCommonData("Player")=="Sakuya"){
SetSpeed(3.5,1.8);
}
if(GetCommonData("Player")=="Sakuya"){//咲夜の場合はグレイズ判定を大きくする
SetGrazeCircle(35);
}else{
SetGrazeCircle(25);
}
if(GetCommonData("Player")=="Marisa"){//魔理沙の場合はアイテム回収ラインを低くする
SetItemCollectLine(200);
}else{
SetItemCollectLine(150);
}


if(GetCommonData("Player")=="Reimu"){//霊夢の処理開始
ShotFrame1++;
ShotFrame2++;
if(GetCommonData("Power")>0){
Pow1=4;
Pow2=3;
}
if(OnBomb==false){//今はボムを使っていない
if(GetCommonData("OKShot")==true){//ショット許可出されている
if(GetKeyState(VK_SLOWMOVE)==KEY_HOLD){//低速移動をしている
ShotFrame2=0;
if(GetKeyState(VK_SHOT)==KEY_HOLD){//ショットキー押しているか
if(ShotFrame1==4){//ショット撃てる
PlaySE("script\SE\PlayerShot1.wav");
//低速ショット
Needle1;
Needle2;
CreatePlayerShot01(GetPlayerX-6,GetPlayerY,20,-90,3,1,2);
CreatePlayerShot01(GetPlayerX+6,GetPlayerY,20,-90,3,1,2);
if(GetCommonData("Power")>99){
Needle3;
}
if(GetCommonData("Power")>199){

Needle4;
}
if(GetCommonData("Power")>299){
Needle5;
}
//低速ショット終了
ShotFrame1=0;
}//ショット撃てる終了
}else{
ShotFrame1=0;
}//ショットキー押している終了
}else{//高速移動をしている
ShotFrame1=0;
if(GetKeyState(VK_SHOT)==KEY_HOLD){//ショットキー押しているか
if(ShotFrame2==5){//ショット撃てる
PlaySE("script\SE\PlayerShot1.wav");
//高速ショット
Homing1;
CreatePlayerShot01(GetPlayerX-6,GetPlayerY,20,-90,3,1,2);
CreatePlayerShot01(GetPlayerX+6,GetPlayerY,20,-90,3,1,2);
if(GetCommonData("Power")>99){
Homing2;
}
if(GetCommonData("Power")>199){
Homing3;
}
if(GetCommonData("Power")>299){
Homing4;
}
//高速ショット終了
ShotFrame2=0;
}//ショット撃てる終了
}else{
ShotFrame2=0;
}//ショットキー押している終了
}//高速移動をしている終了
	
	
	
	
	
}//ショット許可が出ている終了
}//ボムを使っていない終了
	
	
	

	
}//霊夢の処理終了

if(GetKeyState(VK_SLOWMOVE)==KEY_HOLD){
if(Boxset==0){
HitBox1;
HitBox2;
Boxset=1;
}
}else{
Boxset=0;
}


}
task Needle5{
let obj=Obj_Create(OBJ_SHOT);
let Angle1=-90;
let Frame1=0;
let HitFrame=0;
let EfeX=0;
let EfeY=0;
let EfeOk=false;
let Speed=1;
if(GetCommonData("Power")>299){
Obj_SetX(obj,GetPlayerX);//x座標設定
Obj_SetY(obj, GetPlayerY);//y座標設定;
}
Obj_SetAlpha(obj,150);
Obj_SetSpeed(obj,20);//速度設定
ObjShot_SetGraphic(obj,3);//画像設定
ObjShot_SetDamage(obj,Pow2);//ダメージを設定
ObjShot_SetPenetration(obj,1);
Obj_SetAngle(obj,Angle1);
loop{
EfeX=Obj_GetX(obj);
EfeY=Obj_GetY(obj);
Frame1++;
Obj_SetSpeed(obj,Speed);
if(Speed>20){
}else{
Speed+=1;
}
if(Obj_IsIntersected(obj)){
Efe;
break;
}

task Efe{
let X=EfeX;
let Y=EfeY-10;	
let img1="script\script_Player\PlayerShot.png";
let rect01=8;
let rect02=16;
let rect03=15;
let rect04=79;
let Layer=3;
let Scale=1;
let Scale2=1;
let Alpha=255;
let W=(rect03-rect01)/2;
let H=(rect04-rect02)/2;
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,X,Y);
ObjEffect_SetAngle(obj,0,0,0);
ObjEffect_SetScale(obj,Scale,Scale2);
ObjEffect_SetRenderState(obj,ADD);
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);
loop{
ObjEffect_SetAngle(obj,0,0,rand(-5,5));
ObjEffect_SetScale(obj,Scale,Scale2);
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>2){
}else{
Scale+=0.05;
}
if(Scale2>4){
Obj_Delete(obj);
break;
}else{
Scale2+=0.5;
}
if(Alpha<0){
}else{
Alpha-=30;
}
yield;
}
}
yield;
}
}
task Needle4{
let obj=Obj_Create(OBJ_SHOT);
let Angle1=-90;
let Frame1=0;
let HitFrame=0;
let EfeX=0;
let EfeY=0;
let EfeOk=false;
let Speed=1;
if(GetCommonData("Power")>199){
Obj_SetX(obj,GetPlayerX+20);//x座標設定
Obj_SetY(obj, GetPlayerY);//y座標設定;
}
if(GetCommonData("Power")>299){
Obj_SetX(obj,GetPlayerX+25);//x座標設定
Obj_SetY(obj, GetPlayerY);//y座標設定;
}
Obj_SetAlpha(obj,150);
Obj_SetSpeed(obj,20);//速度設定
ObjShot_SetGraphic(obj,3);//画像設定
ObjShot_SetDamage(obj,Pow2);//ダメージを設定
ObjShot_SetPenetration(obj,1);
Obj_SetAngle(obj,Angle1);
loop{
EfeX=Obj_GetX(obj);
EfeY=Obj_GetY(obj);
Frame1++;
Obj_SetSpeed(obj,Speed);
if(Speed>20){
}else{
Speed+=1;
}
if(Obj_IsIntersected(obj)){
Efe;
break;
}

task Efe{
let X=EfeX;
let Y=EfeY-10;	
let img1="script\script_Player\PlayerShot.png";
let rect01=8;
let rect02=16;
let rect03=15;
let rect04=79;
let Layer=3;
let Scale=1;
let Scale2=1;
let Alpha=255;
let W=(rect03-rect01)/2;
let H=(rect04-rect02)/2;
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,X,Y);
ObjEffect_SetAngle(obj,0,0,0);
ObjEffect_SetScale(obj,Scale,Scale2);
ObjEffect_SetRenderState(obj,ADD);
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);
loop{
ObjEffect_SetAngle(obj,0,0,rand(-5,5));
ObjEffect_SetScale(obj,Scale,Scale2);
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>2){
}else{
Scale+=0.05;
}
if(Scale2>4){
Obj_Delete(obj);
break;
}else{
Scale2+=0.5;
}
if(Alpha<0){
}else{
Alpha-=30;
}
yield;
}
}
yield;
}
}
task Needle3{
let obj=Obj_Create(OBJ_SHOT);
let Angle1=-90;
let Frame1=0;
let HitFrame=0;
let EfeX=0;
let EfeY=0;
let EfeOk=false;
let Speed=1;
if(GetCommonData("Power")>99){
Obj_SetX(obj,GetPlayerX-10);//x座標設定
Obj_SetY(obj, GetPlayerY);//y座標設定;
}
if(GetCommonData("Power")>199){
Obj_SetX(obj,GetPlayerX-20);//x座標設定
Obj_SetY(obj, GetPlayerY);//y座標設定;
}
if(GetCommonData("Power")>299){
Obj_SetX(obj,GetPlayerX-25);//x座標設定
Obj_SetY(obj, GetPlayerY);//y座標設定;
}
Obj_SetAlpha(obj,150);
Obj_SetSpeed(obj,20);//速度設定
ObjShot_SetGraphic(obj,3);//画像設定
ObjShot_SetDamage(obj,Pow2);//ダメージを設定
ObjShot_SetPenetration(obj,1);
Obj_SetAngle(obj,Angle1);
loop{
EfeX=Obj_GetX(obj);
EfeY=Obj_GetY(obj);
Frame1++;
Obj_SetSpeed(obj,Speed);
if(Speed>20){
}else{
Speed+=1;
}
if(Obj_IsIntersected(obj)){
Efe;
break;
}

task Efe{
let X=EfeX;
let Y=EfeY-10;	
let img1="script\script_Player\PlayerShot.png";
let rect01=8;
let rect02=16;
let rect03=15;
let rect04=79;
let Layer=3;
let Scale=1;
let Scale2=1;
let Alpha=255;
let W=(rect03-rect01)/2;
let H=(rect04-rect02)/2;
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,X,Y);
ObjEffect_SetAngle(obj,0,0,0);
ObjEffect_SetScale(obj,Scale,Scale2);
ObjEffect_SetRenderState(obj,ADD);
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);
loop{
ObjEffect_SetAngle(obj,0,0,rand(-5,5));
ObjEffect_SetScale(obj,Scale,Scale2);
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>2){
}else{
Scale+=0.05;
}
if(Scale2>4){
Obj_Delete(obj);
break;
}else{
Scale2+=0.5;
}
if(Alpha<0){
}else{
Alpha-=30;
}
yield;
}
}
yield;
}
}
task Needle2{
let obj=Obj_Create(OBJ_SHOT);
let Angle1=-90;
let Frame1=0;
let HitFrame=0;
let EfeX=0;
let EfeY=0;
let EfeOk=false;
let Speed=1;
if(GetCommonData("Power")>0){
Obj_SetX(obj,GetPlayerX+10);//x座標設定
Obj_SetY(obj, GetPlayerY);//y座標設定;
}
if(GetCommonData("Power")>99){
Obj_SetX(obj,GetPlayerX+10);//x座標設定
Obj_SetY(obj, GetPlayerY);//y座標設定;
}
if(GetCommonData("Power")>199){
Obj_SetX(obj,GetPlayerX+10);//x座標設定
Obj_SetY(obj, GetPlayerY);//y座標設定;
}
if(GetCommonData("Power")>299){
Obj_SetX(obj,GetPlayerX+15);//x座標設定
Obj_SetY(obj, GetPlayerY);//y座標設定;
}
Obj_SetAlpha(obj,150);
Obj_SetSpeed(obj,20);//速度設定
ObjShot_SetGraphic(obj,3);//画像設定
ObjShot_SetDamage(obj,Pow2);//ダメージを設定
ObjShot_SetPenetration(obj,1);
Obj_SetAngle(obj,Angle1);
loop{
EfeX=Obj_GetX(obj);
EfeY=Obj_GetY(obj);
Frame1++;
Obj_SetSpeed(obj,Speed);
if(Speed>20){
}else{
Speed+=1;
}
if(Obj_IsIntersected(obj)){
Efe;
break;
}

task Efe{
let X=EfeX;
let Y=EfeY-10;	
let img1="script\script_Player\PlayerShot.png";
let rect01=8;
let rect02=16;
let rect03=15;
let rect04=79;
let Layer=3;
let Scale=1;
let Scale2=1;
let Alpha=255;
let W=(rect03-rect01)/2;
let H=(rect04-rect02)/2;
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,X,Y);
ObjEffect_SetAngle(obj,0,0,0);
ObjEffect_SetScale(obj,Scale,Scale2);
ObjEffect_SetRenderState(obj,ADD);
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);
loop{
ObjEffect_SetAngle(obj,0,0,rand(-5,5));
ObjEffect_SetScale(obj,Scale,Scale2);
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>2){
}else{
Scale+=0.05;
}
if(Scale2>4){
Obj_Delete(obj);
break;
}else{
Scale2+=0.5;
}
if(Alpha<0){
}else{
Alpha-=30;
}
yield;
}
}
yield;
}
}
task Needle1{
let obj=Obj_Create(OBJ_SHOT);
let Angle1=-90;
let Frame1=0;
let HitFrame=0;
let EfeX=0;
let EfeY=0;
let EfeOk=false;
let Speed=1;
if(GetCommonData("Power")>0){
Obj_SetX(obj,GetPlayerX-10);//x座標設定
Obj_SetY(obj, GetPlayerY);//y座標設定;
}
if(GetCommonData("Power")>99){
Obj_SetX(obj,GetPlayerX);//x座標設定
Obj_SetY(obj, GetPlayerY);//y座標設定;
}
if(GetCommonData("Power")>199){
Obj_SetX(obj,GetPlayerX-10);//x座標設定
Obj_SetY(obj, GetPlayerY);//y座標設定;
}
if(GetCommonData("Power")>299){
Obj_SetX(obj,GetPlayerX-15);//x座標設定
Obj_SetY(obj, GetPlayerY);//y座標設定;
}
Obj_SetAlpha(obj,150);
Obj_SetSpeed(obj,20);//速度設定
ObjShot_SetGraphic(obj,3);//画像設定
ObjShot_SetDamage(obj,Pow2);//ダメージを設定
ObjShot_SetPenetration(obj,1);
Obj_SetAngle(obj,Angle1);
loop{
EfeX=Obj_GetX(obj);
EfeY=Obj_GetY(obj);
Frame1++;
Obj_SetSpeed(obj,Speed);
if(Speed>20){
}else{
Speed+=1;
}
if(Obj_IsIntersected(obj)){
Efe;
break;
}

task Efe{
let X=EfeX;
let Y=EfeY-10;	
let img1="script\script_Player\PlayerShot.png";
let rect01=8;
let rect02=16;
let rect03=15;
let rect04=79;
let Layer=3;
let Scale=1;
let Scale2=1;
let Alpha=255;
let W=(rect03-rect01)/2;
let H=(rect04-rect02)/2;
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,X,Y);
ObjEffect_SetAngle(obj,0,0,0);
ObjEffect_SetScale(obj,Scale,Scale2);
ObjEffect_SetRenderState(obj,ADD);
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);
loop{
ObjEffect_SetAngle(obj,0,0,rand(-5,5));
ObjEffect_SetScale(obj,Scale,Scale2);
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>2){
}else{
Scale+=0.05;
}
if(Scale2>4){
Obj_Delete(obj);
break;
}else{
Scale2+=0.5;
}
if(Alpha<0){
}else{
Alpha-=30;
}
yield;
}
}
yield;
}
}
task Homing4{
let obj=Obj_Create(OBJ_SHOT);
let Angle1=-90;
let Frame1=0;
let Frame2=0;
let Set1=0;
let HitFrame=0;
let Limit=0;
let mo=0;
let Angle2=atan2(GetEnemyY-5-Obj_GetY(obj),GetEnemyX-Obj_GetX(obj));
let Count=0;
let EfeX=0;
let EfeY=0;
let EfeOk=false;
let Hit=Obj_IsIntersected(obj);
let Speed=1;
if(GetCommonData("Power")>199){
Obj_SetX(obj,GetPlayerX-10);//x座標設定
Obj_SetY(obj, GetPlayerY+30);//y座標設定;
}
if(GetCommonData("Power")>299){
Obj_SetX(obj,GetPlayerX+15);//x座標設定
Obj_SetY(obj, GetPlayerY+30);//y座標設定;
}
Obj_SetAlpha(obj,150);
Obj_SetSpeed(obj,5);//速度設定
ObjShot_SetGraphic(obj,1);//画像設定
ObjShot_SetDamage(obj,Pow1);//ダメージを設定
ObjShot_SetPenetration(obj,1);
Obj_SetAngle(obj,Angle1);
loop{
EfeX=Obj_GetX(obj);
EfeY=Obj_GetY(obj);
Frame1++;
Obj_SetSpeed(obj,Speed);
if(Speed>7){
}else{
Speed+=0.5;
}
if(Obj_IsIntersected(obj)){
if(EfeOk==false){

}else{
EfeOk=true;
}
break;
}
if(GetEnemyNum==0){
if(GetCommonData("Power")>0){
Obj_SetAngle(obj,-90);
}
}else{
let Angle2=atan2(GetEnemyY-5-Obj_GetY(obj),GetEnemyX-Obj_GetX(obj))-70;
let GetAngleToEnemy=atan2(GetEnemyY-5-Obj_GetY(obj),GetEnemyX-Obj_GetX(obj));
let DAngle=20;
let Ret=GetAngleToEnemy-Angle2;
if((Ret>0&&Ret<=180)||(Ret<0&&Ret<=-180)){Angle2+=DAngle;}
else if((Ret>0&&Ret>180)||(Ret<0&&Ret>-180)){Angle2-=DAngle;}
if(Angle2>=360){Angle2-=360;}//360°以上なら0〜360内に補正
if(Angle2<0){Angle2+=360;}//0°未満なら0〜360内に補正
Obj_SetAngle(obj,Angle2);
if(Count==240){ObjShot_FadeDelete(obj);}//300フレームで消滅
Count++;
Obj_SetAngle(obj,Angle2);

}
task Efe{
let X=EfeX;
let Y=EfeY;	
let img1="script\script_Player\PlayerShot.png";
let rect01=32;
let rect02=0;
let rect03=47;
let rect04=15;
let Layer=3;
let Scale=1;
let Alpha=150;
let W=(rect03-rect01)/2;
let H=(rect04-rect02)/2;
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,X,Y);
ObjEffect_SetAngle(obj,0,0,Angle2);
ObjEffect_SetScale(obj,Scale,Scale);
ObjEffect_SetRenderState(obj,ADD);
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);
loop{
Obj_SetPosition(obj,X,Y);
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){
Obj_Delete(obj);
break;
}else{
Scale+=0.5;
}
if(Alpha<0){
}else{
Alpha-=10;
}
yield;
}
}
yield;
}
}
task Homing3{
let obj=Obj_Create(OBJ_SHOT);
let Angle1=-90;
let Frame1=0;
let Frame2=0;
let Set1=0;
let HitFrame=0;
let Limit=0;
let mo=0;
let Angle2=atan2(GetEnemyY-5-Obj_GetY(obj),GetEnemyX-Obj_GetX(obj));
let Count=0;
let EfeX=0;
let EfeY=0;
let EfeOk=false;
let Hit=Obj_IsIntersected(obj);
let Speed=1;
if(GetCommonData("Power")>199){
Obj_SetX(obj,GetPlayerX);//x座標設定
Obj_SetY(obj, GetPlayerY+30);//y座標設定;
}
if(GetCommonData("Power")>299){
Obj_SetX(obj,GetPlayerX-15);//x座標設定
Obj_SetY(obj, GetPlayerY+30);//y座標設定;
}
Obj_SetAlpha(obj,150);
Obj_SetSpeed(obj,5);//速度設定
ObjShot_SetGraphic(obj,1);//画像設定
ObjShot_SetDamage(obj,Pow1);//ダメージを設定
ObjShot_SetPenetration(obj,1);
Obj_SetAngle(obj,Angle1);
loop{
EfeX=Obj_GetX(obj);
EfeY=Obj_GetY(obj);
Frame1++;
Obj_SetSpeed(obj,Speed);
if(Speed>7){
}else{
Speed+=0.5;
}
if(Obj_IsIntersected(obj)){
if(EfeOk==false){
}else{
EfeOk=true;
}
break;
}
if(GetEnemyNum==0){
if(GetCommonData("Power")>0){
Obj_SetAngle(obj,-90);
}
}else{
let Angle2=atan2(GetEnemyY-5-Obj_GetY(obj),GetEnemyX-Obj_GetX(obj))-70;
let GetAngleToEnemy=atan2(GetEnemyY-5-Obj_GetY(obj),GetEnemyX-Obj_GetX(obj));
let DAngle=20;
let Ret=GetAngleToEnemy-Angle2;
if((Ret>0&&Ret<=180)||(Ret<0&&Ret<=-180)){Angle2+=DAngle;}
else if((Ret>0&&Ret>180)||(Ret<0&&Ret>-180)){Angle2-=DAngle;}
if(Angle2>=360){Angle2-=360;}//360°以上なら0〜360内に補正
if(Angle2<0){Angle2+=360;}//0°未満なら0〜360内に補正
Obj_SetAngle(obj,Angle2);
if(Count==240){ObjShot_FadeDelete(obj);}//300フレームで消滅
Count++;
Obj_SetAngle(obj,Angle2);

}
task Efe{
let X=EfeX;
let Y=EfeY;	
let img1="script\script_Player\PlayerShot.png";
let rect01=32;
let rect02=0;
let rect03=47;
let rect04=15;
let Layer=3;
let Scale=1;
let Alpha=150;
let W=(rect03-rect01)/2;
let H=(rect04-rect02)/2;
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,X,Y);
ObjEffect_SetAngle(obj,0,0,Angle2);
ObjEffect_SetScale(obj,Scale,Scale);
ObjEffect_SetRenderState(obj,ADD);
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);
loop{
Obj_SetPosition(obj,X,Y);
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){
Obj_Delete(obj);
break;
}else{
Scale+=0.5;
}
if(Alpha<0){
}else{
Alpha-=10;
}
yield;
}
}
yield;
}
}
task Homing2{
let obj=Obj_Create(OBJ_SHOT);
let Angle1=-90;
let Frame1=0;
let Frame2=0;
let Set1=0;
let HitFrame=0;
let Limit=0;
let mo=0;
let Angle2=atan2(GetEnemyY-5-Obj_GetY(obj),GetEnemyX-Obj_GetX(obj));
let Count=0;
let EfeX=0;
let EfeY=0;
let EfeOk=false;
let Hit=Obj_IsIntersected(obj);
let Speed=1;
if(GetCommonData("Power")>99){
Obj_SetX(obj,GetPlayerX+30);//x座標設定
Obj_SetY(obj, GetPlayerY);//y座標設定;
}
Obj_SetAlpha(obj,150);
Obj_SetSpeed(obj,5);//速度設定
ObjShot_SetGraphic(obj,1);//画像設定
ObjShot_SetDamage(obj,Pow1);//ダメージを設定
ObjShot_SetPenetration(obj,1);
Obj_SetAngle(obj,Angle1);
loop{
EfeX=Obj_GetX(obj);
EfeY=Obj_GetY(obj);
Frame1++;
Obj_SetSpeed(obj,Speed);
if(Speed>7){
}else{
Speed+=0.5;
}
if(Obj_IsIntersected(obj)){
if(EfeOk==false){

}else{
EfeOk=true;
}
break;
}
if(GetEnemyNum==0){
if(GetCommonData("Power")>0){
Obj_SetAngle(obj,-90);
}
}else{
let Angle2=atan2(GetEnemyY-5-Obj_GetY(obj),GetEnemyX-Obj_GetX(obj))-70;
let GetAngleToEnemy=atan2(GetEnemyY-5-Obj_GetY(obj),GetEnemyX-Obj_GetX(obj));
let DAngle=20;
let Ret=GetAngleToEnemy-Angle2;
if((Ret>0&&Ret<=180)||(Ret<0&&Ret<=-180)){Angle2+=DAngle;}
else if((Ret>0&&Ret>180)||(Ret<0&&Ret>-180)){Angle2-=DAngle;}
if(Angle2>=360){Angle2-=360;}//360°以上なら0〜360内に補正
if(Angle2<0){Angle2+=360;}//0°未満なら0〜360内に補正
Obj_SetAngle(obj,Angle2);
if(Count==240){ObjShot_FadeDelete(obj);}//300フレームで消滅
Count++;
Obj_SetAngle(obj,Angle2);

}
task Efe{
let X=EfeX;
let Y=EfeY;	
let img1="script\script_Player\PlayerShot.png";
let rect01=32;
let rect02=0;
let rect03=47;
let rect04=15;
let Layer=3;
let Scale=1;
let Alpha=150;
let W=(rect03-rect01)/2;
let H=(rect04-rect02)/2;
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,X,Y);
ObjEffect_SetAngle(obj,0,0,Angle2);
ObjEffect_SetScale(obj,Scale,Scale);
ObjEffect_SetRenderState(obj,ADD);
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);
loop{
Obj_SetPosition(obj,X,Y);
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){
Obj_Delete(obj);
break;
}else{
Scale+=0.5;
}
if(Alpha<0){
}else{
Alpha-=10;
}
yield;
}
}
yield;
}
}
task Homing1{
let obj=Obj_Create(OBJ_SHOT);
let Angle1=-90;
let Frame1=0;
let Frame2=0;
let Set1=0;
let HitFrame=0;
let Limit=0;
let mo=0;
let Angle2=atan2(GetEnemyY-5-Obj_GetY(obj),GetEnemyX-Obj_GetX(obj));
let Count=0;
let EfeX=0;
let EfeY=0;
let EfeOk=false;
let Hit=Obj_IsIntersected(obj);
let Speed=1;
if(GetCommonData("Power")>0){
Obj_SetX(obj,GetPlayerX);//x座標設定
Obj_SetY(obj, GetPlayerY+30);//y座標設定;
}
if(GetCommonData("Power")>99){
Obj_SetX(obj,GetPlayerX-30);//x座標設定
Obj_SetY(obj, GetPlayerY);//y座標設定;
}
Obj_SetAlpha(obj,150);
Obj_SetSpeed(obj,5);//速度設定
ObjShot_SetGraphic(obj,1);//画像設定
ObjShot_SetDamage(obj,Pow1);//ダメージを設定
ObjShot_SetPenetration(obj,1);
Obj_SetAngle(obj,Angle1);
loop{
EfeX=Obj_GetX(obj);
EfeY=Obj_GetY(obj);
Frame1++;
Obj_SetSpeed(obj,Speed);
if(Speed>7){
}else{
Speed+=0.5;
}
if(Obj_IsIntersected(obj)){
if(EfeOk==false){

}else{
EfeOk=true;
}
break;
}
if(GetEnemyNum==0){
if(GetCommonData("Power")>0){
Obj_SetAngle(obj,-90);
}
}else{
let Angle2=atan2(GetEnemyY-5-Obj_GetY(obj),GetEnemyX-Obj_GetX(obj))-70;
let GetAngleToEnemy=atan2(GetEnemyY-5-Obj_GetY(obj),GetEnemyX-Obj_GetX(obj));
let DAngle=20;
let Ret=GetAngleToEnemy-Angle2;
if((Ret>0&&Ret<=180)||(Ret<0&&Ret<=-180)){Angle2+=DAngle;}
else if((Ret>0&&Ret>180)||(Ret<0&&Ret>-180)){Angle2-=DAngle;}
if(Angle2>=360){Angle2-=360;}//360°以上なら0〜360内に補正
if(Angle2<0){Angle2+=360;}//0°未満なら0〜360内に補正
Obj_SetAngle(obj,Angle2);
if(Count==240){ObjShot_FadeDelete(obj);}//300フレームで消滅
Count++;
Obj_SetAngle(obj,Angle2);

}
task Efe{
let X=EfeX;
let Y=EfeY;	
let img1="script\script_Player\PlayerShot.png";
let rect01=32;
let rect02=0;
let rect03=47;
let rect04=15;
let Layer=3;
let Scale=1;
let Alpha=150;
let W=(rect03-rect01)/2;
let H=(rect04-rect02)/2;
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,X,Y);
ObjEffect_SetAngle(obj,0,0,Angle2);
ObjEffect_SetScale(obj,Scale,Scale);
ObjEffect_SetRenderState(obj,ADD);
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);
loop{
Obj_SetPosition(obj,X,Y);
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){
Obj_Delete(obj);
break;
}else{
Scale+=0.5;
}
if(Alpha<0){
}else{
Alpha-=10;
}
yield;
}
}
yield;
}
}
task Option4{
let X=GetPlayerX;
let Y=GetPlayerY+30;	
let rect01=0;
let rect02=144;
let rect03=15;
let rect04=159;
let Layer=4;
let Scale=1;
let Alpha=150;
let Angle=0;
let W=(rect03-rect01)/2;
let H=(rect04-rect02)/2;
let obj = Obj_Create(OBJ_EFFECT);
ObjEffect_SetTexture(obj,PlayerImg_Reimu);
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
ObjEffect_CreateVertex(obj, 4);
ObjEffect_SetLayer(obj,Layer);
Obj_SetPosition(obj,X,Y);
ObjEffect_SetAngle(obj,0,0,Angle);
ObjEffect_SetScale(obj,Scale,Scale);
ObjEffect_SetRenderState(obj,ALPHA);
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);
loop{

if(GetCommonData("Power")>299){
ObjEffect_SetAngle(obj,0,0,Angle);
Angle+=5;
if(GetCommonData("Player")=="Reimu"){
ObjEffect_SetTexture(obj,PlayerImg_Reimu);
Obj_SetPosition(obj,GetPlayerX-15,GetPlayerY+30);
}
if(GetCommonData("Player")=="Marisa"){
ObjEffect_SetTexture(obj,PlayerImg_Marisa);
Obj_SetPosition(obj,GetPlayerX,GetPlayerY-30);
}

if(GetCommonData("Player")=="Sakuya"){
ObjEffect_SetTexture(obj,PlayerImg_Marisa);
Obj_SetPosition(obj,GetPlayerX,GetPlayerY-30);
}	
}else{
Obj_SetPosition(obj,0,0);	
}

yield;
}
}
task Option3{
let X=GetPlayerX;
let Y=GetPlayerY+30;	
let rect01=0;
let rect02=144;
let rect03=15;
let rect04=159;
let Layer=4;
let Scale=1;
let Alpha=150;
let Angle=0;
let W=(rect03-rect01)/2;
let H=(rect04-rect02)/2;
let obj = Obj_Create(OBJ_EFFECT);
ObjEffect_SetTexture(obj,PlayerImg_Reimu);
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
ObjEffect_CreateVertex(obj, 4);
ObjEffect_SetLayer(obj,Layer);
Obj_SetPosition(obj,X,Y);
ObjEffect_SetAngle(obj,0,0,Angle);
ObjEffect_SetScale(obj,Scale,Scale);
ObjEffect_SetRenderState(obj,ALPHA);
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);
loop{

if(GetCommonData("Power")>199){
ObjEffect_SetAngle(obj,0,0,Angle);
Angle+=5;
if(GetCommonData("Player")=="Reimu"){
ObjEffect_SetTexture(obj,PlayerImg_Reimu);
Obj_SetPosition(obj,GetPlayerX,GetPlayerY+30);
}
if(GetCommonData("Player")=="Marisa"){
ObjEffect_SetTexture(obj,PlayerImg_Marisa);
Obj_SetPosition(obj,GetPlayerX,GetPlayerY-30);
}

if(GetCommonData("Player")=="Sakuya"){
ObjEffect_SetTexture(obj,PlayerImg_Marisa);
Obj_SetPosition(obj,GetPlayerX,GetPlayerY-30);
}	
}else if(GetCommonData("Power")>299){
ObjEffect_SetAngle(obj,0,0,Angle);
Angle+=5;
if(GetCommonData("Player")=="Reimu"){
ObjEffect_SetTexture(obj,PlayerImg_Reimu);
Obj_SetPosition(obj,GetPlayerX+15,GetPlayerY+30);
}
if(GetCommonData("Player")=="Marisa"){
ObjEffect_SetTexture(obj,PlayerImg_Marisa);
Obj_SetPosition(obj,GetPlayerX,GetPlayerY-30);
}

if(GetCommonData("Player")=="Sakuya"){
ObjEffect_SetTexture(obj,PlayerImg_Marisa);
Obj_SetPosition(obj,GetPlayerX,GetPlayerY-30);
}	
}
if(GetCommonData("Power")<200){
Obj_SetPosition(obj,0,0);	
}

yield;
}
}
task Option2{
let X=GetPlayerX;
let Y=GetPlayerY+30;	
let rect01=0;
let rect02=144;
let rect03=15;
let rect04=159;
let Layer=4;
let Scale=1;
let Alpha=150;
let Angle=0;
let W=(rect03-rect01)/2;
let H=(rect04-rect02)/2;
let obj = Obj_Create(OBJ_EFFECT);
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
ObjEffect_CreateVertex(obj, 4);
ObjEffect_SetLayer(obj,Layer);
Obj_SetPosition(obj,X,Y);
ObjEffect_SetTexture(obj,PlayerImg_Reimu);
ObjEffect_SetAngle(obj,0,0,Angle);
ObjEffect_SetScale(obj,Scale,Scale);
ObjEffect_SetRenderState(obj,ALPHA);
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);
loop{
if(GetCommonData("Power")>99){
ObjEffect_SetAngle(obj,0,0,Angle);
Angle+=5;
if(GetCommonData("Player")=="Reimu"){
ObjEffect_SetTexture(obj,PlayerImg_Reimu);
Obj_SetPosition(obj,GetPlayerX+30,GetPlayerY);
}
if(GetCommonData("Player")=="Marisa"){
ObjEffect_SetTexture(obj,PlayerImg_Marisa);
Obj_SetPosition(obj,GetPlayerX,GetPlayerY-30);
}

if(GetCommonData("Player")=="Sakuya"){
ObjEffect_SetTexture(obj,PlayerImg_Marisa);
Obj_SetPosition(obj,GetPlayerX,GetPlayerY-30);
}	
}

if(GetCommonData("Power")<100){
Obj_SetPosition(obj,0,0);	
}
yield;
}
}
task Option1{
let X=GetPlayerX;
let Y=GetPlayerY+30;	
let rect01=0;
let rect02=144;
let rect03=15;
let rect04=159;
let Layer=4;
let Scale=1;
let Alpha=150;
let Angle=0;
let W=(rect03-rect01)/2;
let H=(rect04-rect02)/2;
let obj = Obj_Create(OBJ_EFFECT);
ObjEffect_SetTexture(obj,PlayerImg_Reimu);
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
ObjEffect_CreateVertex(obj, 4);
ObjEffect_SetLayer(obj,Layer);
Obj_SetPosition(obj,X,Y);
ObjEffect_SetAngle(obj,0,0,Angle);
ObjEffect_SetScale(obj,Scale,Scale);
ObjEffect_SetRenderState(obj,ALPHA);
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);
loop{

if(GetCommonData("Power")>0){
ObjEffect_SetAngle(obj,0,0,Angle);
Angle+=5;
if(GetCommonData("Player")=="Reimu"){
ObjEffect_SetTexture(obj,PlayerImg_Reimu);
Obj_SetPosition(obj,GetPlayerX,GetPlayerY+30);
}
if(GetCommonData("Player")=="Marisa"){
ObjEffect_SetTexture(obj,PlayerImg_Marisa);
Obj_SetPosition(obj,GetPlayerX,GetPlayerY-30);
}
if(GetCommonData("Player")=="Sakuya"){
ObjEffect_SetTexture(obj,PlayerImg_Marisa);
Obj_SetPosition(obj,GetPlayerX,GetPlayerY-30);
}	
}
if(GetCommonData("Power")>99){
ObjEffect_SetAngle(obj,0,0,Angle);
Angle+=5;
if(GetCommonData("Player")=="Reimu"){
ObjEffect_SetTexture(obj,PlayerImg_Reimu);
Obj_SetPosition(obj,GetPlayerX-30,GetPlayerY);
}
if(GetCommonData("Player")=="Marisa"){
ObjEffect_SetTexture(obj,PlayerImg_Marisa);
Obj_SetPosition(obj,GetPlayerX,GetPlayerY-30);
}

if(GetCommonData("Player")=="Sakuya"){
ObjEffect_SetTexture(obj,PlayerImg_Marisa);
Obj_SetPosition(obj,GetPlayerX,GetPlayerY-30);
}	
}
yield;
}
}
task HitBox1{
let X=GetPlayerX;
let Y=GetPlayerY;
let rect01=0;
let rect02=0;
let rect03=64;
let rect04=64;
let Layer=7;
let alpha=0;
let W=(rect03-rect01)/2;
let H=(rect04-rect02)/2;
let scale=1.5;
let angle=0;
let frame1=0;
let frame2=0;
let obj = Obj_Create(OBJ_EFFECT);
ObjEffect_SetTexture(obj,Img_HitBox);
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
ObjEffect_CreateVertex(obj, 4);
ObjEffect_SetRenderState(obj,ALPHA);
ObjEffect_SetLayer(obj,Layer);
Obj_SetPosition(obj,X,Y);
ObjEffect_SetAngle(obj,0,0,rand(-10,10));
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, 100, 255, 255, 255);
ObjEffect_SetVertexColor(obj, 1, 100, 255, 255, 255);
ObjEffect_SetVertexColor(obj, 2, 100, 255, 255, 255);
ObjEffect_SetVertexColor(obj, 3, 100, 255, 255, 255);
loop{
ObjEffect_SetScale(obj,scale,scale);
ObjEffect_SetAngle(obj,0,0,angle);
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<1){
}else{
scale-=0.1;
}
if(alpha>255){
}else{
alpha+=50;
}
angle+=2;
X=GetPlayerX;
Y=GetPlayerY;
Obj_SetPosition(obj,X,Y);
if(GetKeyState(VK_SLOWMOVE)==KEY_HOLD){
}else{
if(alpha<0){
}else{
alpha-=50;
}
if(scale<0){
}else{
scale-=0.1;
}
frame1++;
}
if(frame1==10){
Obj_Delete(obj);
break;
}
yield;
}
}
task HitBox2{
let X=GetPlayerX;
let Y=GetPlayerY;
let rect01=0;
let rect02=0;
let rect03=64;
let rect04=64;
let Layer=7;
let alpha=0;
let W=(rect03-rect01)/2;
let H=(rect04-rect02)/2;
let scale=1.5;
let angle=0;
let frame1=0;
let frame2=0;
let obj = Obj_Create(OBJ_EFFECT);
ObjEffect_SetTexture(obj,Img_HitBox);
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
ObjEffect_CreateVertex(obj, 4);
ObjEffect_SetRenderState(obj,ALPHA);
ObjEffect_SetLayer(obj,Layer);
Obj_SetPosition(obj,X,Y);
ObjEffect_SetAngle(obj,0,0,rand(-10,10));
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, 100, 255, 255, 255);
ObjEffect_SetVertexColor(obj, 1, 100, 255, 255, 255);
ObjEffect_SetVertexColor(obj, 2, 100, 255, 255, 255);
ObjEffect_SetVertexColor(obj, 3, 100, 255, 255, 255);
loop{
ObjEffect_SetScale(obj,scale,scale);
ObjEffect_SetAngle(obj,0,0,angle);
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<1){
}else{
scale-=0.1;
}
if(alpha>255){
}else{
alpha+=50;
}
angle-=2;
X=GetPlayerX;
Y=GetPlayerY;
Obj_SetPosition(obj,X,Y);
if(GetKeyState(VK_SLOWMOVE)==KEY_HOLD){
}else{
if(alpha<0){
}else{
alpha-=50;
}
if(scale<0){
}else{
scale-=0.1;
}
frame1++;
}
if(frame1==10){
Obj_Delete(obj);
break;
}
yield;
}
}
@Missed{

}
    

@SpellCard{
if(GetCommonData("Player")=="Reimu"){
UseSpellCard("ReimuSpell",true);
}
if(GetCommonData("Player")=="Marisa"){
UseSpellCard("MarisaSpell",true);
}
if(GetCommonData("Player")=="Sakuya"){
UseSpellCard("SakuyaSpell",true);
}
}
    
@DrawLoop{
if(GetCommonData("Player")=="Reimu"){
SetTexture(PlayerImg_Reimu);
}
if(GetCommonData("Player")=="Marisa"){
SetTexture(PlayerImg_Marisa);
}
if(GetCommonData("Player")=="Sakuya"){
SetTexture(PlayerImg_Sakuya);
}


if((GetKeyState(VK_LEFT) == KEY_PUSH) || (GetKeyState(VK_LEFT) == KEY_HOLD)) {
//左
Anime3=0;
Anime1=0;

}else if((GetKeyState(VK_RIGHT) == KEY_PUSH) || (GetKeyState(VK_RIGHT) == KEY_HOLD)) {
//右
Anime2=0;
Anime1=0;

}else{
//通常移動
if(Anime1>24){
Anime1=0;
}else{
}
Anime2=0;
Anime3=0;

}
//正面アニメ
if(Anime1==1){
SetGraphicRect(0,0,31,47);
}
if(Anime1==5){
SetGraphicRect(32,0,63,47);
}
if(Anime1==9){
SetGraphicRect(64,0,95,47);
}
if(Anime1==14){
SetGraphicRect(96,0,127,47);
}
if(Anime1==19){
SetGraphicRect(128,0,159,47);
}
//正面アニメ終わり
//左アニメ
if(Anime2==1){
SetGraphicRect(0,48,31,95);
}
if(Anime2==3){
SetGraphicRect(32,48,63,95);
}
if(Anime2==5){
SetGraphicRect(64,48,95,95);
}
if(Anime2==7){
SetGraphicRect(96,48,127,95);
}
if(Anime2==9){
SetGraphicRect(128,48,159,95);
}
//左アニメ終わり
//右アニメ
if(Anime3==1){
SetGraphicRect(0,96,31,143);
}
if(Anime3==3){
SetGraphicRect(32,96,63,143);
}
if(Anime3==5){
SetGraphicRect(64,96,95,143);
}
if(Anime3==7){
SetGraphicRect(96,96,127,143);
}
if(Anime3==9){
SetGraphicRect(128,96,159,143);
}
//右アニメ終わり
DrawGraphic(GetPlayerX, GetPlayerY);




}
    
@Finalize{
 
}





}

script_spell ReimuSpell{
let frame1=0;
let LightX=0;
let LightY=0;
let ToAngle2=0;
let angle1=-90;
let Angle2=-90;
let Count=0;
angle1=rand(0,360);
task LightHoming{
let obj=Obj_Create(OBJ_SHOT);
let frame1=0;
let scale=0;
let angle1=-90;
let set1=0;
let set2=0;
let set3=0;
let set4=0;
Obj_SetX(obj,GetPlayerX);//x座標設定
Obj_SetY(obj, GetPlayerY);//y座標設定;
Obj_SetAlpha(obj,0);
Obj_SetSpeed(obj,0);//速度設定
ObjShot_SetGraphic(obj,4);//画像設定
ObjShot_SetDamage(obj,2);//ダメージを設定
Obj_SetAutoDelete(obj,false);

ObjShot_SetPenetration(obj,100000);//貫通力は適当に大きく
Obj_SetAngle(obj,90);
task LightDamage{
let X=LightX;
let Y=LightY;
let Collar4=255;
let Collar5=255;
let Collar6=255;
let img1="script\script_Player\PlayerShot.png";
let rect01=65;
let rect02=104;
let rect03=167;
let rect04=207;
let hit = Obj_Create(OBJ_SPELL);
let Layer=4;
let alpha=255;
let scale2=0;
let Angle2=90;
let W=(rect03-rect01)/2;
let H=(rect04-rect02)/2;
let scale=0;
let obj = Obj_Create(OBJ_EFFECT);
Collar4=rand(0,255);
Collar5=rand(0,255);
Collar6=rand(0,255);
LoadGraphic(img1);
ObjEffect_SetTexture(obj,img1);
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
ObjEffect_CreateVertex(obj, 4);
ObjEffect_SetRenderState(obj,ADD);
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,alpha,255,255,255);
ObjEffect_SetVertexColor(obj,1,alpha,233,148,51);
ObjEffect_SetVertexColor(obj,2,alpha,255,53,199);
ObjEffect_SetVertexColor(obj,3,alpha,29,347,127);
loop{
ObjEffect_SetScale(obj,scale,scale);
scale+=0.3;
scale2+=30;
alpha-=5;
Collar4+=1;
Collar5+=1;
Collar6+=1;
ObjEffect_SetVertexColor(obj,0,alpha,255,255,255);
ObjEffect_SetVertexColor(obj,1,alpha,Collar4,Collar5,Collar6);
ObjEffect_SetVertexColor(obj,2,alpha,Collar4,Collar5,Collar6);
ObjEffect_SetVertexColor(obj,3,alpha,Collar4,Collar5,Collar6);
ObjSpell_SetIntersecrionCircle(hit,LightX,LightY,scale2,1,true);
yield;
}
}
task Light{
let X=LightX;
let Y=LightY;
let Collar1=255;
let Collar2=255;
let Collar3=255;
let img1="script\script_Player\PlayerShot.png";
let rect01=64;
let rect02=0;
let rect03=167;
let rect04=103;
let Layer=4;
let W=(rect03-rect01)/2;
let H=(rect04-rect02)/2;
let angle=0;
let obj = Obj_Create(OBJ_EFFECT);
Collar1=rand(0,255);
Collar2=rand(0,255);
Collar3=rand(0,255);
LoadGraphic(img1);
ObjEffect_SetTexture(obj,img1);
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
ObjEffect_CreateVertex(obj, 4);
ObjEffect_SetRenderState(obj,ADD);
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,Collar1,Collar2,Collar3);
ObjEffect_SetVertexColor(obj,2,255,Collar1,Collar2,Collar3);
ObjEffect_SetVertexColor(obj,3,255,Collar1,Collar2,Collar3);
loop{
X=LightX;
Y=LightY;
Collar1++;
Collar2++;
Collar3++;
Obj_SetPosition(obj,X,Y);

angle+=5;
if(set3==1){
ObjEffect_SetVertexColor(obj,0,0,255,255,255);
ObjEffect_SetVertexColor(obj,1,0,Collar1,Collar2,Collar3);
ObjEffect_SetVertexColor(obj,2,0,Collar1,Collar2,Collar3);
ObjEffect_SetVertexColor(obj,3,0,Collar1,Collar2,Collar3);

}
yield;
}
}
Light;
loop{
frame1++;
LightX=Obj_GetX(obj);
LightY=Obj_GetY(obj);
if(set2==0){
let tAng=(angle1-40*60);
let X=GetPlayerX+scale*cos(tAng);
let Y=GetPlayerY+scale*sin(tAng);
Obj_SetPosition(obj,X,Y);
angle1+=11;
}

if(set1==1){
scale-=5;
}else{
if(scale>150){
}else{
scale+=5;
}	
}

if(set2==1){

}

if(frame1==120){
set1=1;
}
if(frame1==150){
set2=1;

set4=1;
}
if(set4==1){
if(GetEnemyNum==0){
Obj_SetAngle(obj,rand(0,360));
set4=0;
}else{
Obj_SetAngle(obj,rand(0,360));
set4=0;
}

}
if(frame1==155){
Obj_SetSpeed(obj,2);
}
if(frame1==160){
Obj_SetSpeed(obj,3);
}
if(frame1==165){
Obj_SetSpeed(obj,4);
}
if(frame1==170){
Obj_SetSpeed(obj,5);
}
if(frame1==175){
Obj_SetSpeed(obj,6);
}
if(frame1==180){
Obj_SetSpeed(obj,7);
}
if(frame1==185){
Obj_SetSpeed(obj,8);
}
if(frame1==190){
Obj_SetSpeed(obj,9);
}
if(frame1==195){
set3=1;
PlaySE("script\SE\Shot1.wav");
Obj_Delete(obj);
LightDamage;
}
yield;
}
}
@Initialize{
SetPlayerInvincibility(300);
run();
}

@MainLoop{
yield;
frame1++;
if(frame1==1){
PlaySE("script\SE\Spark.wav");
}
if(frame1==10){
LightHoming;
}
if(frame1==14){
LightHoming;
}	
if(frame1==18){
LightHoming;
}	
if(frame1==22){
LightHoming;
}
if(frame1==26){
LightHoming;
}
if(frame1==30){
LightHoming;
}	
if(frame1==34){
LightHoming;
}	
if(frame1==38){
LightHoming;
}	
if(frame1==200){
}	
}
	

@Finalize{
End;
}
task run(){
loop(48){yield;}//組み込みのカットインが終わるまで待機
loop(240){;yield;}

End();
}
}