#Title[反応「弾幕バイオリズム」]
#Text[古明地こいしのスペルカード]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
        let count=0;
        let cx=GetCenterX();
        let cy=GetCenterY();
        let csd     = GetCurrentScriptDirectory;
        let imgBoss =csd~"img\ExKoishi.png";
        let name    = "反応「弾幕バイオリズム」";
	let imgEnemy=csd~"img\familiar.png";
	let imgALPHA=255;
        let ranX=0;
        let angle=0;

    @Initialize {
    CutIn(YOUMU,name,0,0,0,0,0);

        SetLife(1);
        SetTimer(30);
        SetScore(2000000);
        SetDamageRate(0,0);
	SetEnemyMarker(false);

        SetInvincibility(0);
        SetDurableSpellCard;

        SetMovePosition02(cx,120,60);
	LoadGraphic(imgBoss);
	LoadGraphic(imgEnemy);
	LoadUserShotData(csd~"img\PLUS_shot.txt");

	imgALPHA=150;
	CreateEnemyFromScript("DOLL01",GetX,GetY,0,0,1);
	CreateEnemyFromScript("DOLL02",GetX,GetY,0,0,1);
	CreateEnemyFromScript("DOLL03",GetX,GetY,0,0,1);
	CreateEnemyFromScript("DOLL04",GetX,GetY,0,0,1);
	CreateEnemyFromScript("DOLL05",GetX,GetY,0,0,1);
    }

        @MainLoop
        {
        }

        @DrawLoop {
		SetRenderState(ALPHA);
		SetTexture(imgBoss);
		SetGraphicScale(1,1);
		SetAlpha(imgALPHA);
		SetColor(255,255,255);
		if(int(GetSpeedX())==0)
		{SetGraphicRect(128,0,255,127);}
		else if(GetSpeedX()>0){SetGraphicRect(384,0,511,127);}
		else if(GetSpeedX()<0){SetGraphicRect(256,0,383,127);}
		DrawGraphic(GetX(),GetY());
	}
        
        @Finalize
        {
		loop(50){
			angle=rand(0,360);
			CreateItem(ITEM_SCORE,GetX+cos(angle)*rand(35,45),GetY+sin(angle)*rand(35,45));
		}
		DeleteGraphic(imgBoss);
		DeleteGraphic(imgEnemy);
        } 
}

script_enemy DOLL01 {
        let count=0;
        let cx=GetCenterX();
        let cy=GetCenterY();
        let csd     = GetCurrentScriptDirectory;
	let MAnimation=0;
	let imgEnemy=csd~"img\familiar.png";
	let imgAngle=0;
	let shotseA=csd~"se\ShotSE02.wav";

    @Initialize {
        SetLife(1000);
        SetInvincibility(0);
	SetX(50);
	SetY(0);
    }

        @MainLoop
        {
	imgAngle+=4;
	if(imgAngle>360){imgAngle=0;}
	MAnimation-=10;
	if(MAnimation<-360){MAnimation=0;}
        if(count>=50&&count%20==0){
		SetMovePosition02(rand(0,cx-50),0,20);
        	}
	if(count>=30&&count%6==0){
        SetShotDirectionType(ABSOLUTE);
	PlaySE(shotseA);
        let shot01 = 1;
        CreateShotA(shot01,GetX(),GetY(),0);
        SetShotDataA(shot01,0,3,90,0,0,3,176);
        FireShot(shot01);
	}
        count++;
        }

        @DrawLoop {
		SetGraphicRect(288,48,336,96);
		SetTexture(imgEnemy);
		SetGraphicScale(1,1);
		SetColor(255,255,255);
		SetRenderState(ALPHA);
		SetGraphicAngle(0,0,imgAngle);
		DrawGraphic(GetX(),GetY());
		SetGraphicAngle(0,0,-imgAngle);
		DrawGraphic(GetX(),GetY());
	}
        
        @Finalize
        {
        }
}

script_enemy DOLL02 {
        let count=0;
        let cx=GetCenterX();
        let cy=GetCenterY();
        let csd     = GetCurrentScriptDirectory;
	let MAnimation=0;
	let imgEnemy=csd~"img\familiar.png";
	let imgAngle=0;

    @Initialize {
        SetLife(1000);
        SetInvincibility(0);
	SetX(100);
	SetY(0);
    }

        @MainLoop
        {
	imgAngle+=4;
	if(imgAngle>360){imgAngle=0;}
	MAnimation-=10;
	if(MAnimation<-360){MAnimation=0;}
        if(count>=50&&count%20==0){
		SetMovePosition02(rand(50,cx+50),0,20);
        	}
	if(count>=30&&count%6==0){
        SetShotDirectionType(ABSOLUTE);
        let shot01 = 1;
        CreateShotA(shot01,GetX(),GetY(),0);
        SetShotDataA(shot01,0,2,90,0,0,2,175);
        FireShot(shot01);
	}
        count++;
        }

        @DrawLoop {
		SetGraphicRect(288,48,336,96);
		SetTexture(imgEnemy);
		SetGraphicScale(1,1);
		SetColor(255,255,255);
		SetRenderState(ALPHA);
		SetGraphicAngle(0,0,imgAngle);
		DrawGraphic(GetX(),GetY());
		SetGraphicAngle(0,0,-imgAngle);
		DrawGraphic(GetX(),GetY());
	}
        
        @Finalize
        {
        }
}

script_enemy DOLL03 {
        let count=0;
        let cx=GetCenterX();
        let cy=GetCenterY();
        let csd     = GetCurrentScriptDirectory;
	let MAnimation=0;
	let imgEnemy=csd~"img\familiar.png";
	let imgAngle=0;

    @Initialize {
        SetLife(1000);
        SetInvincibility(0);
	SetX(398);
	SetY(0);
    }

        @MainLoop
        {
	imgAngle+=4;
	if(imgAngle>360){imgAngle=0;}
	MAnimation-=10;
	if(MAnimation<-360){MAnimation=0;}
        if(count>=50&&count%20==0){
		SetMovePosition02(rand(cx+50,448),0,20);
        	}
	if(count>=30&&count%6==0){
        SetShotDirectionType(ABSOLUTE);
        let shot01 = 1;
        CreateShotA(shot01,GetX(),GetY(),0);
        SetShotDataA(shot01,0,3,90,0,0,3,171);
        FireShot(shot01);
	}
        count++;
        }

        @DrawLoop {
		SetGraphicRect(288,48,336,96);
		SetTexture(imgEnemy);
		SetGraphicScale(1,1);
		SetColor(255,255,255);
		SetRenderState(ALPHA);
		SetGraphicAngle(0,0,imgAngle);
		DrawGraphic(GetX(),GetY());
		SetGraphicAngle(0,0,-imgAngle);
		DrawGraphic(GetX(),GetY());
	}
        
        @Finalize
        {
        }
}

script_enemy DOLL04 {
        let count=0;
        let cx=GetCenterX();
        let cy=GetCenterY();
        let csd     = GetCurrentScriptDirectory;
	let MAnimation=0;
	let imgEnemy=csd~"img\familiar.png";
	let imgAngle=0;

    @Initialize {
        SetLife(1000);
        SetInvincibility(0);
	SetX(348);
	SetY(0);
    }

        @MainLoop
        {
	imgAngle+=4;
	if(imgAngle>360){imgAngle=0;}
	MAnimation-=10;
	if(MAnimation<-360){MAnimation=0;}
        if(count>=50&&count%20==0){
		SetMovePosition02(rand(cx-50,398),0,20);
        	}
	if(count>=30&&count%6==0){
        SetShotDirectionType(ABSOLUTE);
        let shot01 = 1;
        CreateShotA(shot01,GetX(),GetY(),0);
        SetShotDataA(shot01,0,2,90,0,0,2,172);
        FireShot(shot01);
	}
        count++;
        }

        @DrawLoop {
		SetGraphicRect(288,48,336,96);
		SetTexture(imgEnemy);
		SetGraphicScale(1,1);
		SetColor(255,255,255);
		SetRenderState(ALPHA);
		SetGraphicAngle(0,0,imgAngle);
		DrawGraphic(GetX(),GetY());
		SetGraphicAngle(0,0,-imgAngle);
		DrawGraphic(GetX(),GetY());
	}
        
        @Finalize
        {
        }
}

script_enemy DOLL05 {
        let count=0;
        let cx=GetCenterX();
        let cy=GetCenterY();
        let csd     = GetCurrentScriptDirectory;
	let MAnimation=0;
	let imgEnemy=csd~"img\familiar.png";
	let imgAngle=0;

    @Initialize {
        SetLife(1000);
        SetInvincibility(0);
	SetX(cx);
	SetY(0);
    }

        @MainLoop
        {
	imgAngle+=4;
	if(imgAngle>360){imgAngle=0;}
	MAnimation-=10;
	if(MAnimation<-360){MAnimation=0;}
        if(count>=50&&count%20==0){
		SetMovePosition02(GetPlayerX,0,20);
        	}
	if(count>=30&&count%6==0){
        SetShotDirectionType(ABSOLUTE);
        let shot01 = 1;
        CreateShotA(shot01,GetX(),GetY(),0);
        SetShotDataA(shot01,0,3,90,0,0,3,174);
        FireShot(shot01);
	}
        count++;
        }

        @DrawLoop {
		SetGraphicRect(288,48,336,96);
		SetTexture(imgEnemy);
		SetGraphicScale(1,1);
		SetColor(255,255,255);
		SetRenderState(ALPHA);
		SetGraphicAngle(0,0,imgAngle);
		DrawGraphic(GetX(),GetY());
		SetGraphicAngle(0,0,-imgAngle);
		DrawGraphic(GetX(),GetY());
	}
        
        @Finalize
        {
        }
}