#東方弾幕風[Stage]
#Title[東方創破環 〜Creation Not End Of Reincarnation]
#Text[東方二次創作弾幕シューティング]
#Image[]
#BackGround[Default]
#Player[script\script_Player\PlayerScript.txt]
#ScriptVersion[2]

script_stage_main{//メインスクリプト開始
#include_function "script\Script-Main\NormalStage.txt"
#include_function "script\Script-Main\NumberData.txt"
#include_function "script\Script-Main\TitleData.txt"
#include_function "script\Script-Main\SystemData.txt"
#include_function "script\Script-Stage1\Stage1-Lord.txt"
#include_function "script\Script-Stage1\Stage1-Back.txt"
#include_function "script\Script-Stage2\Stage2-Lord.txt"
#include_function "script\Script-Stage2\Stage2-Back.txt"
#include_function "script\Script-Stage3\Stage3-Back.txt"
let Title=true;//タイトル画面の場合はtrue　ゲーム中ならfalse
let Command1=1;//メインタイトルカーソル
let Command2=1;//難易度選択カーソル
let Command3=1;//キャラ選択カーソル
let Command4=1;//オプションカーソル
let Scene=1;//現在シーン(1.メインメニュー　2.難易度選択　3.キャラ選択　4.オプション　5.EX難易度選択　6.EXキャラ選択　7.本編)
let MainTime=0;
let RankTime=0;
let PlayerTime=0;
let Cx=GetCenterX;
let Cy=GetCenterY;
let Score=12345678;
let Frame1=0;
let Frame2=0;
let Frame3=0;
let Frame4=0;
let Frame5=0;
let Life=0;
let Bomb=0;
let StageNo=0;
let OK1=0;
let OK2=0;
let OK3=0;
let OK4=0;
let OK5=0;
let OK6=0;
let OK7=0;
let EX1=0;
let EX2=0;
let EX3=0;
let EX4=0;
let EX5=0;
let EX6=0;
let EX7=0;
let EX8=0;
let EX9=0;
let EX10=0;
let Graze=0;

let MoveMode=0;
SetCommonData("1END",false);
SetCommonData("2END",false);
SetCommonData("3END",false);
let Enemyimg="script\img-System\EnemySet.png";
SetCommonData("GameEnd","false");
SetCommonData("Rank","E");
SetCommonData("Player","NoPlayer");
SetCommonData("Power",1);
SetCommonData("OKShot",false);
SetCommonData("Grudge",223);//生命ゲージ
SetCommonData("SamonPoint",false);//敵撃破時true起動でポイントアイテム投下
SetCommonData("SamonPower",false);//敵撃破時true起動でパワーアイテム投下
SetCommonData("SamonBigPower",false);//敵撃破時true起動で大パワーアイテム投下
SetCommonData("SamonBomb",false);//敵撃破時true起動でボムアイテム投下
SetCommonData("Samon1UP",false);//敵撃破時true起動でエクステンドアイテム投下
SetCommonData("EnemyVanish",false);//敵撃破時true起動で敵撃破エフェクト表示
task StageTask{//ステージタスク
function Wait(let frame){loop(frame){yield};}
function WaitForZeroEnemy{while(GetEnemyNum != 0){yield;}}	
Wait(1);
PlayMusic("script\BGM\No.01.mp3");
TitleBack;
Wait(20);
TitleReimu;
Wait(25);
TitleName;
Wait(30);
TitleCommand1;
TitleCommand2;
TitleCommand3;
TitleCommand4;
RankCommand1;
RankCommand2;
RankCommand3;
RankCommand4;
CharacterCommand2;
CharacterCommand;
StgFrame;
ScoreNum1;
ScoreNum2;
ScoreNum3;
ScoreNum4;
ScoreNum5;
ScoreNum6;
ScoreNum7;
ScoreNum8;
ScoreNum9;
loop{//ループ開始
if(Title==true){//現在タイトル画面の場合
yield;

if(Scene==1){//現在のシーンはメインメニューか？
RankTime=0;
MainTime++;
PlayerTime=0;
if(MainTime>5){
if(GetKeyState(VK_DOWN)==KEY_PUSH){//下キーを軽く押しているか？
if(Command1==1){//ゲームスタートを選んでいるか？
PlaySE("script\SE\Select.wav");
Command1=2;//エキストラへコマンド移動
MainTime=0;
}else//ゲームスタート終わり
if(Command1==2){//エキストラスタートを選んでいるか？
PlaySE("script\SE\Select.wav");
Command1=3;//オプションへコマンド移動
MainTime=0;
}else//エキストラスタート終わり
if(Command1==3){//オプションを選んでいるか？
PlaySE("script\SE\Select.wav");
Command1=4;//Quitへコマンド移動
MainTime=0;
}//オプション終わり
}//下キー軽く処理終了
if(GetKeyState(VK_UP)==KEY_PUSH){//上キーを軽く押しているか？
if(Command1==2){//エキストラスタートを選んでいるか？
PlaySE("script\SE\Select.wav");
Command1=1;//ゲームスタートへコマンド移動
MainTime=0;
}else//エキストラスタート終わり
if(Command1==3){//オプションを選んでいるか？
PlaySE("script\SE\Select.wav");
Command1=2;//エキストラスタートへコマンド移動
MainTime=0;
}else//オプション終わり
if(Command1==4){//Quitを選んでいるか？
PlaySE("script\SE\Select.wav");
Command1=3;//オプションへコマンド移動
MainTime=0;
}//Quit終わり
}//上キー軽く処理終了
if(GetKeyState(VK_SHOT)==KEY_PUSH){//決定キーを軽く押しているか？
if(Command1==1){//ゲームスタートを選んでいるか？
PlaySE("script\SE\Ok.wav");
Command2=2;//次の難易度選択をノーマルに設定
Scene=2;//シーンを難易度選択に
MainTime=0;
}else//ゲームスタート終わり
if(Command1==2){//エキストラスタートを選んでいるか？
PlaySE("script\SE\Ok.wav");
Command1=2;//エキストラスタートへコマンド移動
MainTime=0;
}else//エキストラスタート終わり
if(Command1==3){//オプションを選んでいるか？
PlaySE("script\SE\Ok.wav");
Command1=3;//オプションへコマンド移動
MainTime=0;
}else//オプション終わり
if(Command1==4){//Quitを選んでいるか？
PlaySE("script\SE\Ok.wav");
ClearStage;//ゲームの強制終了
Command1=4;//オプションへコマンド移動
MainTime=0;
}
}//決定キー軽く処理終了
}
}//メインメニュー処理終わり




if(Scene==2){//現在のシーンは難易度選択か？
RankTime++;
MainTime=0;
PlayerTime=0;
if(RankTime>5){
if(GetKeyState(VK_DOWN)==KEY_PUSH){//下キーを軽く押しているか？
	
if(Command2==1){//イージーを選んでいるか？
PlaySE("script\SE\Select.wav");
Command2=2;//コマンド移動
RankTime=0;
}else//イージー終わり
if(Command2==2){//ノーマルを選んでいるか？
PlaySE("script\SE\Select.wav");
Command2=3;//コマンド移動
RankTime=0;
}else//ノーマル終わり
if(Command2==3){//ハードを選んでいるか？
PlaySE("script\SE\Select.wav");
Command2=4;//コマンド移動
RankTime=0;
}
}//下キー軽く処理終了

if(GetKeyState(VK_UP)==KEY_PUSH){//上キーを軽く押しているか？
if(Command2==2){//ノーマルを選んでいるか？
PlaySE("script\SE\Select.wav");
Command2=1;//コマンド移動
RankTime=0;
}else//ノーマル終わり
if(Command2==3){//ハードを選んでいるか？
PlaySE("script\SE\Select.wav");
Command2=2;//コマンド移動
RankTime=0;
}else//ハード終わり
if(Command2==4){//ルナを選んでいるか？
PlaySE("script\SE\Select.wav");
Command2=3;//コマンド移動
RankTime=0;
}//ルナ終わり
}//上キー軽く処理終了
if(GetKeyState(VK_SHOT)==KEY_PUSH){//決定キーを軽く押しているか？
if(Command2==1){//イージーを選んでいるか？
PlaySE("script\SE\Ok.wav");
SetCommonData("Rank","E");//難易度をイージーに
Scene=3;//シーンをキャラ選択に
Command3=1;
}else//イージー終わり
if(Command2==2){//ノーマルを選んでいるか？
PlaySE("script\SE\Ok.wav");
SetCommonData("Rank","N");//難易度をノーマルに
Scene=3;//シーンをキャラ選択に
Command3=1;
}else//ノーマル終わり
if(Command2==3){//ハードを選んでいるか？
PlaySE("script\SE\Ok.wav");
SetCommonData("Rank","H");//難易度をハードに
Scene=3;//シーンをキャラ選択に
Command3=1;
}else//ハード終わり
if(Command2==4){//ルナを選んでいるか？
PlaySE("script\SE\Ok.wav");
SetCommonData("Rank","L");//難易度をルナティックに
Scene=3;//シーンをキャラ選択に
Command3=1;
}
}//決定キー軽く処理終了
if(GetKeyState(VK_BOMB)==KEY_PUSH){//キャンセルキーを軽く押しているか？
if(Command2==1){//イージーを選んでいるか？
PlaySE("script\SE\Cancel.wav");
Scene=1;//シーンをキャラ選択に
Command1=1;//ゲームスタートからコマンド開始
}else//イージー終わり
if(Command2==2){//ノーマルを選んでいるか？
PlaySE("script\SE\Cancel.wav");
Scene=1;//シーンをキャラ選択に
Command1=1;//ゲームスタートからコマンド開始
}else//ノーマル終わり
if(Command2==3){//ハードを選んでいるか？
PlaySE("script\SE\Cancel.wav");
Scene=1;//シーンをキャラ選択に
Command1=1;//ゲームスタートからコマンド開始
}else//ハード終わり
if(Command2==4){//ルナを選んでいるか？
PlaySE("script\SE\Cancel.wav");
Scene=1;//シーンをキャラ選択に
Command1=1;//ゲームスタートからコマンド開始
}
}//キャンセルキー軽く処理終了
}
}//難易度選択処理終わり



if(Scene==3){//現在のシーンはキャラ選択か？
PlayerTime++;
RankTime=0;
MainTime=0;
if(PlayerTime>5){
if(GetKeyState(VK_LEFT)==KEY_PUSH){//左キーを軽く押しているか？
	
if(Command3==1){//霊夢を選んでいるか？
PlaySE("script\SE\Select.wav");
Command3=3;//コマンド移動
}else//霊夢終わり
if(Command3==2){//魔理沙を選んでいるか？
PlaySE("script\SE\Select.wav");
Command3=1;//コマンド移動
PlayerTime=0;
}else//魔理沙終わり
if(Command3==3){//早苗を選んでいるか？
PlaySE("script\SE\Select.wav");
Command3=2;//コマンド移動
PlayerTime=0;
}else{
}
}//左キー軽く処理終了

if(GetKeyState(VK_RIGHT)==KEY_PUSH){//右キーを軽く押しているか？
	
if(Command3==1){//霊夢を選んでいるか？
PlaySE("script\SE\Select.wav");
Command3=2;//コマンド移動
PlayerTime=0;
}else//霊夢終わり
if(Command3==2){//魔理沙を選んでいるか？
PlaySE("script\SE\Select.wav");
Command3=3;//コマンド移動
PlayerTime=0;
}else//ノーマル終わり
if(Command3==3){//咲夜を選んでいるか？
PlaySE("script\SE\Select.wav");
Command3=1;//コマンド移動
PlayerTime=0;
}else{
}
}//右キー軽く処理終了

if(GetKeyState(VK_SHOT)==KEY_PUSH){//決定キーを軽く押しているか？
if(Command3==1){//霊夢を選んでいるか？
PlaySE("script\SE\Ok.wav");
SetCommonData("Player","Reimu");
Scene=7;//ゲームスタート
Title=false;
}else//霊夢終わり
if(Command3==2){//魔理沙を選んでいるか？
PlaySE("script\SE\Buzzer.wav");
}else//ノーマル終わり
if(Command3==3){//咲夜を選んでいるか？
PlaySE("script\SE\Buzzer.wav");
}else{
}
}//決定キー軽く処理終了

if(GetKeyState(VK_BOMB)==KEY_PUSH){//キャンセルキーを軽く押しているか？
if(Command3==1){//霊夢を選んでいるか？
PlaySE("script\SE\Cancel.wav");
Scene=2;//シーンを難易度選択に
}else
if(Command3==2){//魔理沙を選んでいるか？
PlaySE("script\SE\Cancel.wav");
Scene=2;//シーンを難易度選択に
}else
if(Command3==3){//昨夜を選んでいるか？
PlaySE("script\SE\Cancel.wav");
Scene=2;//シーンを難易度選択に
}
}//キャンセルキー軽く処理終了
}
}//キャラ選択処理終わり




}else{//ゲーム中だった場合開始
ScoreLine;
ScoreName;
GrazeLine;
GrazeName;
GrazeNum1;
GrazeNum2;
GrazeNum3;
GrazeNum4;
PowerNum1;
PowerNum2;
PowerNum3;
RankImg;
Reiryoku;
LifeLine;
BombLine;
PlayerLife;
NormalStage;


if(GetCommonData("GameEnd")=="true"){
	
}else{
loop{

yield;
}
}



yield;
}//ゲーム中だった場合終了
ForbidShot(false);//ショット許可命令
ForbidBomb(false);//ボム許可命令
}//ループ終了

}
@DrawTopObject{
if(Title==true){
}else{
Frame1++;

SetCommonData("Grudge",GetCommonData("Grudge")-1);


}
}
@Initialize{
LoadGraphic(Enemyimg);
SetDefaultStatusVisible(false);
StageTask;//ステージタスク起動


}
	
@MainLoop{
yield;//タスク復帰
if(Title==true){
ForbidShot(true);//ショット命令
ForbidBomb(true);//ボム命令
SetCommonData("OKShot",true);
}else{
Life=GetPlayerLife;
Bomb=GetPlayerBomb;
if(GetCommonData("SamonPoint")==true){
loop(4){
ItemPoint;
}
SetCommonData("SamonPoint",false);
}
if(GetCommonData("SamonPower")==true){
loop(1){
ItemPower;
}
SetCommonData("SamonPower",false);
}
if(GetCommonData("EnemyVanish")==true){
Vanish;
SetCommonData("EnemyVanish",false);
}
if(GetCommonData("SamonBigPower")==true){
loop(1){
ItemBigPower;
}
SetCommonData("SamonBigPower",false);
}
if(GetCommonData("SamonBomb")==true){
loop(1){
ItemBomb;
}
SetCommonData("SamonBomb",false);
}
if(GetCommonData("Samon1UP")==true){
loop(1){
Item1UP;
}
SetCommonData("Samon1UP",false);
}
}


Graze=GetGraze;
if(Graze>199){
if(EX1==1){
}else{
PlaySE("script\SE\Extend.wav");
ExtendPlayer(1);
EX1=1;
}
}
if(Graze>199){
if(EX2==1){
}else{
PlaySE("script\SE\Extend.wav");
ExtendPlayer(1);
EX2=1;
}
}
if(Graze>399){
if(EX3==1){
}else{
PlaySE("script\SE\Extend.wav");
ExtendPlayer(1);
EX3=1;
}
}
if(Graze>599){
if(EX4==1){
}else{
PlaySE("script\SE\Extend.wav");
ExtendPlayer(1);
EX4=1;
}
}
if(Graze>799){
if(EX5==1){
}else{
PlaySE("script\SE\Extend.wav");
ExtendPlayer(1);
EX5=1;
}
}
if(Graze>999){
if(EX6==1){
}else{
PlaySE("script\SE\Extend.wav");
ExtendPlayer(1);
EX6=1;
}
}
if(Graze>1199){
if(EX7==1){
}else{
PlaySE("script\SE\Extend.wav");
ExtendPlayer(1);
EX7=1;
}
}
if(Graze>1399){
if(EX8==1){
}else{
PlaySE("script\SE\Extend.wav");
ExtendPlayer(1);
EX8=1;
}
}
if(Graze>1599){
if(EX9==1){
}else{
PlaySE("script\SE\Extend.wav");
ExtendPlayer(1);
EX9=1;
}
}
if(Graze>1799){
if(EX10==1){
}else{
PlaySE("script\SE\Extend.wav");
ExtendPlayer(1);
EX10=1;
}
}

}
	
@Finalize{

}

@BackGround{
yield;
if(StageNo==1){
if(OK1==0){
Stage1LordBack;
OK1=1;
}
}
if(StageNo==2){
if(OK2==0){
Stage2LordBack;
OK2=1;
}
}
if(StageNo==3){
if(OK3==0){
Stage3LordBack;
OK3=1;
}
}

}




task StageEnd{
let X=GetCenterX;
let Y=GetCenterY;
let Img1="script\img-System\Clear.png";
let rect01=0;
let rect02=0;
let rect03=384;
let rect04=446;
let Layer=8;
let W=(rect03-rect01)/2;
let H=(rect04-rect02)/2;
let Angle1=0;
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=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++;
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(Frame1==220){
Set1=1;
}
if(Frame1==280){
Obj_Delete(Obj);
break;
}
if(Set1==1){
if(Alpha<0){

}else{
Alpha-=5;
}
}else{
if(Alpha>255){

}else{
Alpha+=5;
}
}

yield;	
}
}
task StageTitle3{
let X=GetCenterX-150;
let Y=GetCenterY-100;
let Img1="script\Script-Stage3\StageTitle-3.png";
let rect01=0;
let rect02=0;
let rect03=428;
let rect04=187;
let Layer=7;
let W=(rect03-rect01)/2;
let H=(rect04-rect02)/2;
let Angle1=0;
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=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);
Obj_SetSpeed(Obj,1);
Obj_SetAngle(Obj,0);
loop{
Frame1++;
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(Frame1==20){
Obj_SetSpeed(Obj,2);
}
if(Frame1==30){
Obj_SetSpeed(Obj,3);
}
if(Frame1==100){
Obj_SetSpeed(Obj,2);
}
if(Frame1==110){
Obj_SetSpeed(Obj,1);
}
if(Frame1==120){
Obj_SetSpeed(Obj,0);
}
if(Frame1==360){
Set1=1;
}
if(Frame1==600){
Obj_Delete(Obj);
break;
}
if(Set1==1){
if(Alpha<0){

}else{
Alpha-=1;
}
}else{
if(Alpha>255){

}else{
Alpha+=5;
}
}

yield;	
}
}
task StageTitle2{
let X=GetCenterX-150;
let Y=GetCenterY-100;
let Img1="script\Script-Stage2\StageTitle-2.png";
let rect01=0;
let rect02=0;
let rect03=428;
let rect04=187;
let Layer=7;
let W=(rect03-rect01)/2;
let H=(rect04-rect02)/2;
let Angle1=0;
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=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);
Obj_SetSpeed(Obj,1);
Obj_SetAngle(Obj,0);
loop{
Frame1++;
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(Frame1==20){
Obj_SetSpeed(Obj,2);
}
if(Frame1==30){
Obj_SetSpeed(Obj,3);
}
if(Frame1==100){
Obj_SetSpeed(Obj,2);
}
if(Frame1==110){
Obj_SetSpeed(Obj,1);
}
if(Frame1==120){
Obj_SetSpeed(Obj,0);
}
if(Frame1==360){
Set1=1;
}
if(Frame1==600){
Obj_Delete(Obj);
break;
}
if(Set1==1){
if(Alpha<0){

}else{
Alpha-=1;
}
}else{
if(Alpha>255){

}else{
Alpha+=5;
}
}

yield;	
}
}
task StageTitle1{
let X=GetCenterX-150;
let Y=GetCenterY-100;
let Img1="script\Script-Stage1\StageTitle-1.png";
let rect01=0;
let rect02=0;
let rect03=428;
let rect04=187;
let Layer=7;
let W=(rect03-rect01)/2;
let H=(rect04-rect02)/2;
let Angle1=0;
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=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);
Obj_SetSpeed(Obj,1);
Obj_SetAngle(Obj,0);
loop{
Frame1++;
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(Frame1==20){
Obj_SetSpeed(Obj,2);
}
if(Frame1==30){
Obj_SetSpeed(Obj,3);
}
if(Frame1==100){
Obj_SetSpeed(Obj,2);
}
if(Frame1==110){
Obj_SetSpeed(Obj,1);
}
if(Frame1==120){
Obj_SetSpeed(Obj,0);
}
if(Frame1==360){
Set1=1;
}
if(Frame1==600){
Obj_Delete(Obj);
break;
}
if(Set1==1){
if(Alpha<0){

}else{
Alpha-=1;
}
}else{
if(Alpha>255){

}else{
Alpha+=5;
}
}

yield;	
}
}
task Reiryoku{
let X=Cx+237;
let Y=Cy-60;
let Img1="script\img-System\EffectSet-1.png";
let rect01=128;
let rect02=64;
let rect03=191;
let rect04=87;
let Layer=8;
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 Alpha=0;
let Obj=Obj_Create(OBJ_EFFECT);
let Boss=0;
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{

yield;	
}
}
task RankImg{
let X=Cx+300;
let Y=Cy-220;
let Img1="script\img-System\EffectSet-1.png";
let rect01=1;
let rect02=241;
let rect03=13;
let rect04=13;
let Layer=8;
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 Alpha=0;
let Obj=Obj_Create(OBJ_EFFECT);
let Boss=0;
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(GetCommonData("Rank")=="E"){
rect01=192;rect02=0;rect03=255;rect04=15;
W=(rect03-rect01)/2;H=(rect04-rect02)/2;
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);
}
if(GetCommonData("Rank")=="N"){
rect01=192;rect02=16;rect03=255;rect04=31;
W=(rect03-rect01)/2;H=(rect04-rect02)/2;
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);
}
if(GetCommonData("Rank")=="H"){
rect01=192;rect02=32;rect03=255;rect04=47;
W=(rect03-rect01)/2;H=(rect04-rect02)/2;
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);
}
if(GetCommonData("Rank")=="L"){
rect01=192;rect02=48;rect03=255;rect04=63;
W=(rect03-rect01)/2;H=(rect04-rect02)/2;
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);
}
if(GetCommonData("Rank")=="EX"){
rect01=192;rect02=48;rect03=255;rect04=63;
W=(rect03-rect01)/2;H=(rect04-rect02)/2;
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);
}
yield;	
}
}


task PlayerLife{
let X=Cx+315;let Y=Cy-80;
let img1="script\img-System\Life-0.png";
let img2="script\img-System\Life-1.png";
let img3="script\img-System\Life-2.png";
let img4="script\img-System\Life-3.png";
let img5="script\img-System\Life-4.png";
let img6="script\img-System\Life-5.png";
let img7="script\img-System\Life-6.png";
let img8="script\img-System\Life-7.png";
let img9="script\img-System\Life-8.png";
let rect01=0;let rect02=0;let rect03=0;let rect04=0;
let Layer=8;let alpha=255;let W=(rect03-rect01)/2;
let H=(rect04-rect02)/2;let frame=0;
let obj = Obj_Create(OBJ_EFFECT);
LoadGraphic(img1);LoadGraphic(img2);LoadGraphic(img3);LoadGraphic(img4);
LoadGraphic(img5);LoadGraphic(img6);LoadGraphic(img7);LoadGraphic(img8);LoadGraphic(img9);
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,1,1);
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, alpha);
ObjEffect_SetVertexColor(obj, 1, 255, 255, 255, alpha);
ObjEffect_SetVertexColor(obj, 2, 255, 255, 255, alpha);
ObjEffect_SetVertexColor(obj, 3, 255, 255, 255, alpha);
ObjEffect_SetRenderState(obj,ALPHA);
loop{
if(Title==false){
let rect01=0;let rect02=0;let rect03=211;let rect04=36;	
W=(rect03-rect01)/2;H=(rect04-rect02)/2;
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);

if(Life==1){
ObjEffect_SetTexture(obj,img1);
}
if(Life==2){
ObjEffect_SetTexture(obj,img2);
}
if(Life==3){
ObjEffect_SetTexture(obj,img3);
}
if(Life==4){
ObjEffect_SetTexture(obj,img4);
}
if(Life==5){
ObjEffect_SetTexture(obj,img5);
}
if(Life==6){
ObjEffect_SetTexture(obj,img6);
}
if(Life==7){
ObjEffect_SetTexture(obj,img7);
}
if(Life==8){
ObjEffect_SetTexture(obj,img8);
}
if(Life==9){
ObjEffect_SetTexture(obj,img9);
}
}
yield;
}
}

task StgFrame{
let X=Cx+125;let Y=Cy;
let img1="script\img-System\StgFrame.png";
let rect01=0;let rect02=0;let rect03=0;let rect04=0;
let Layer=8;let alpha=255;let W=(rect03-rect01)/2;
let H=(rect04-rect02)/2;let frame=0;
let frame1=0;
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,1,1);
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, alpha);
ObjEffect_SetVertexColor(obj, 1, 255, 255, 255, alpha);
ObjEffect_SetVertexColor(obj, 2, 255, 255, 255, alpha);
ObjEffect_SetVertexColor(obj, 3, 255, 255, 255, alpha);
ObjEffect_SetRenderState(obj,ALPHA);
loop{
if(Title==false){
let rect01=0;let rect02=0;let rect03=700;let rect04=480;	
W=(rect03-rect01)/2;H=(rect04-rect02)/2;
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);
}
yield;
}
}





}//メインスクリプト終了
