
	let MagicAbsorbShortRange=60;
	let MagicAbsorbLongRange=150;

	let AutoReCharge=0.625;
	let GrazeRadius=0;
	let AutoItemCollectLine=176;
	let BurstErazeCircleRangeRate=2.7;

	let LightMode=0;
	let count=0;
	let Power=0;		//Power管理変数
	let ReChargePower=0;	//リチャージPower管理変数
	let MagicCounter=0;	//マジックカウンター管理変数
	let MagicFragment=0;
	let SectionMagicFragment=0;
	let opX=[0,1,2,3];	//オプションのX座標
	let opY=[0,1,2,3];	//オプションのY座標
	let OpAngle=0;
	let csd = GetCurrentScriptDirectory();
	let img = csd~"..\img\STG_Player11.png";
	let THimg=csd~"..\img\pl01.png";
	let imgKekkai = csd~"..\img\circle.png";
	let imgShot3 = csd~"..\img\Reimu_shots.png";
	let imgMarisaShot = csd~"..\img\Marisa_shots.png";
	let imgBorderLine = csd~"..\img\SampleEC01a.png";
	let imgWhite = csd~"..\img\White.png";
	let imgBer = csd~"..\img\ber.png";
	let imgNebura = csd~"..\img\nebura.png";
	let imgNumber = csd~"..\img\Number.png";
	let imgItem = csd~"..\img\Item.png";
	let imgAtari = csd~"..\img\Atari.png";
	let imgThunder = csd~"..\img\Thunder.png";
	let imgLight = csd~"..\img\Light.png";
	let imgWhite = csd~"..\img\White.png";
	let imgBreakCircleEffect=csd ~ "..\..\img/circle.png";
	let shotCount = -1;
	let ShotCountIncrease=0;

	let RaiseAutoBomb=false;

	let BurstMode=0;//バースト発動中かどうかの変数
	let BurstModeCount=0;//バーストが発動できるまでの時間
	let DeleteBulletReCharge=0;
	let MagicOpAnglePlus=0;
	let RushGauge=0;
	let OnCansellBomb=0;

	let OnWeak=0;
	let WeaknessCount=0;

	let miss=0;
	let BurstLevel=0;
	let BurstRank=0;
	let BL3=4/3;

	let BorderTime=0;
	let BorderTimeCount=0;

	let ColorRed=255;
	let ColorGreen=0;
	let ColorBlue=0;

	let Sol=0;
	let Luna=0;
	let Stella=0;
	let Terra=0;
	let Mare=0;
	let Caelum=0;

	let THdot=0;

	let PlayerRectLeft=10;
	let PlayerRectUp=38;
	let PlayerRectRight=2;
	let PlayerRectDown=48;

let CharaDrawCount=0;
let DrawFrame=6;
let CharaLeftMoveDrawCount=0;
let CharaRightMoveDrawCount=0;

let UseAutoBombCount=0;


let OnShot=1;
let OnSlow=1;

let RockOnAvailable=false;
let RockOnAvailableCounter=0;
let RockON=[false,false,false,false];
let TargetX=[-1,-1,-1,-1];
let TargetY=[-1,-1,-1,-1];
let OnOpShot=[0,0,0,0];

sub IntializeTask
{
	LoadPlayerShotData(csd~"..\txt\ShotData.txt");
	SetItemCollectLine(AutoItemCollectLine);//アイテム回収されるy座標
	SetGrazeCircle(GrazeRadius);//自機のかすり判定
	SetRebirthFrame(BorderTime+1);//食らいボムの有効フレーム
	SetRebirthFrameReduction(0);//食らいボムの減少フレーム
}

sub IntializeLoading
{
		LoadGraphic(img);
		LoadGraphic(THimg);
		LoadGraphic(imgKekkai);
		LoadGraphic(imgShot3);
		LoadGraphic(imgMarisaShot);
		LoadGraphic(imgBorderLine);
		LoadGraphic(imgBer);
		LoadGraphic(imgNebura);
		LoadGraphic(imgNumber);
		LoadGraphic(imgItem);
		LoadGraphic(imgAtari);
		LoadGraphic(imgThunder);
		LoadGraphic(imgLight);
		LoadGraphic(imgWhite);
		LoadGraphic(imgBreakCircleEffect);
}

sub IntializeTmain
{
		SetCommonData("MagicAbsorbShortRange",MagicAbsorbShortRange);
		SetCommonData("MagicAbsorbLongRange",MagicAbsorbLongRange);
		SetCommonData("BurstErazeCircleRangeRate",BurstErazeCircleRangeRate);
		CommonDataSetting;
		PlayerRect;//プレイヤー切抜き範囲決定タスク
		Pdraw;//バースト回数表示タスク
		optionmove;//オプション位置決定タスク
		Powor;//パワー変動タスク
		Shot;//メインショットのタスク
		SubShot;//サブショットのタスク
		Bdraw;
		HueDifine;//グローバル色相変化タスク
	//	OptionShot;//オプションのオーラ撃ちタスク
		BurstGaugeDisplay;//バーストゲージ２種
		DrawOption;
		DeleteBulletCheck;
		Rankdraw;
		SectionRankdraw;
		PlayerDrawCount;
		NormalShadow;
		Setting;
		CheckPowerState;
		BombCheck;
		SlowKeyCheck;
		BombExtend;
		MissJudg;
		BurstRankdraw;
		BorderTimeDifine;
}

sub MainLoopTask
{
	SetIntersectionCircle(GetPlayerX, GetPlayerY, 0);//自機の当たり判定
	if(WeaknessCount>0)
	{
		WeaknessCount-=1;
	}
	if(GetCommonDataDefault("BOSSDEFEAT",false)==false)
	{
		AddScore(trunc(BurstRank/1000)*1000);
	}
	yield;
}

sub MissLoopTask
{
	MainLoop;
	BorderTimeCount+=1;
	if(BorderTimeCount>BorderTime)
	{
	if(GetPlayerBomb>=1 && GetCommonDataDefault("AutoBombMode",0)!=0)
	{
		RaiseAutoBomb=true;
		CallSpellCard;
	}
	else
	{
		BurstMode=0;
	}
	}
	if(OnBorderOfLife)
	{
	ObjPlayerDraw;
	}
}

sub SpellCardTask
{
		if(OnCansellBomb==1)
		{
			AddBomb(1);
		}
		else if(RaiseAutoBomb)
		{
			if(GetCommonDataDefault("AutoBombMode",0)==0.5){AddBomb(-1);}
			RaiseAutoBomb=false;
			UseSpellCard("MicroHole", 0);
			UseAutoBombCount+=1;
			SetCommonData("UseAutoBombCount",UseAutoBombCount);
		}
		else if(GetKeyState(VK_USER)==KEY_HOLD)
		{
			StartStar;
			SetPlayerInvincibility(150);
			BurstMode=0;
		}	
		else if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH || GetKeyState(VK_SLOWMOVE)==KEY_HOLD)
		{
			if(PlayerType=="A")
			{
			UseSpellCard("DarkNebura", 0);
			}
			if(PlayerType=="B")
			{
			UseSpellCard("StardustFixer", 0);
			}
			if(PlayerType=="C")
			{
			UseSpellCard("ElectricMS", 0);
			}
			if(PlayerType=="D")
			{
			SetCommonData("TargetX",[TargetX[0],TargetX[1],TargetX[2],TargetX[3]]);
			SetCommonData("TargetY",[TargetY[0],TargetY[1],TargetY[2],TargetY[3]]);
			UseSpellCard("StardustPulsar", 0);
			}
		}
		else
		{
			UseSpellCard("NeburaReverie", 0);
		}
}

sub DrawLoopTask
{
	SetTexture(img);
	if(THdot)
	{
		SetTexture(THimg);
	}
	SetGraphicRect(PlayerRectLeft,PlayerRectUp, PlayerRectRight, PlayerRectDown);
	if(WeaknessCount>0)
	{
		SetColor(100,100,255);
	}
	else
	{
		SetColor(255,255,255);
	}
	DrawGraphic(GetPlayerX(), GetPlayerY());//自機の描画
	//DrawText(RushGauge,120,382,12,255);//起動時間の表示

	atari;
}