#東方弾幕風
#Title[通常攻撃2]
#Text[]
#BackGround[Default]
#ScriptVersion[2]

script_enemy_main{

	#include_function ".\lib\lib_anime_Sanae.txt"
	let imgBoss = GetCurrentScriptDirectory() ~ "img\dot_sanae.png";
	let shot  =GetCurrentScriptDirectory~"SE\arrow01.wav";
	let shot2  =GetCurrentScriptDirectory~"SE\kira01_r.wav";
	let shot3  =GetCurrentScriptDirectory~"SE\shoot13.wav";
	let Concentration  =GetCurrentScriptDirectory~"SE\eco00_r.wav";
	let wIni = 120;

	@Initialize{
	SetEnemyMarker(true);
	LoadGraphic(imgBoss);
	LoadUserShotData(GetCurrentScriptDirectory ~ "img\shot_All.txt");
        SetMovePosition02(GetCenterX(), 150, wIni/2);
        SetLife(600);
        SetTimer(70);
        SetInvincibility(wIni*2);
        SetDamageRate(18*1.5, 3.6*1.5);
	LoadGraphic(GetCurrentScriptDirectory~"img\back06_01.png");	
	InitializeAction();
	    
	    TMain();
	}
		
	@MainLoop{
		SetCollisionA(GetX(), GetY(), 32);
		SetCollisionB(GetX(), GetY(), 24);
	    yield;
	}
	
		
	@Finalize{
	DeleteGraphic(imgBoss);
	}
	
	
	task TMain{
	    SetAction(ACT_MOVE, wIni/2);	    
	    yield;
	    loop(wIni/2){ yield; }
          SetAction(ACT_SHOT_B,12000);
	    loop(wIni/2){ yield; }
		TMain2;

	    loop{
	    loop(2){
	    		let a=0;
	    		let a2=0;
	    loop(10){
	    		a=210;
	    		a2=330;
		suzu(80);
	    loop(4){
		CreateShotA(1,GetX-40,GetY-20,10);
		SetShotDirectionType(ABSOLUTE);
		SetShotDataA(1,0,4,a,0,-0.061,0,46);
		SetShotDirectionType(PLAYER);
		SetShotDataA(1,80,4,0,0,0,0,46);
		FireShot(1);
		CreateShotA(1,GetX+40,GetY-20,10);
		SetShotDirectionType(ABSOLUTE);
		SetShotDataA(1,0,4,a2,0,-0.061,0,46);
		SetShotDirectionType(PLAYER);
		SetShotDataA(1,80,4,0,0,0,0,46);
		FireShot(1);
		a+=10;
		a2-=10;
		}
                PlaySE(shot);
	        loop(5){ yield; }
		}
	        loop(15){ yield; }
	    loop(10){
	    		a=190;
	    		a2=350;
		suzu(80);
	    loop(4){
		CreateShotA(1,GetX-40,GetY-10,10);
		SetShotDirectionType(ABSOLUTE);
		SetShotDataA(1,0,4,a,0,-0.061,0,41);
		SetShotDirectionType(PLAYER);
		SetShotDataA(1,80,4,0,0,0,0,41);
		SetShotDirectionType(ABSOLUTE);
		FireShot(1);
		CreateShotA(1,GetX+40,GetY-10,10);
		SetShotDirectionType(ABSOLUTE);
		SetShotDataA(1,0,4,a2,0,-0.061,0,41);
		SetShotDirectionType(PLAYER);
		SetShotDataA(1,80,4,0,0,0,0,41);
		SetShotDirectionType(ABSOLUTE);
		FireShot(1);
		a+=10;
		a2-=10;
		}
                PlaySE(shot);
	        loop(5){ yield; }
		}
	        loop(15){ yield; }
	    }
			move01;
        		SetAction(ACT_MOVE,60);
			}
			}

	task TMain2{
	    		let a3=45;
	    loop{
a3=45;
	    loop(3){
		CreateShotA(1,GetX,GetY,10);
		SetShotDirectionType(ABSOLUTE);
		SetShotDataA(1,0,4,a3,0,0,0,44);
		FireShot(1);
		CreateShotA(1,GetX,GetY,10);
		SetShotDirectionType(ABSOLUTE);
		SetShotDataA(1,0,4,a3+80,0,0,0,44);
		FireShot(1);
		a3+=5;
		}
                PlaySE(shot);
	        loop(10){ yield; }
		}
		}
		task suzu(t){
	        loop(t){ yield; }
                    PlaySE(shot2);
				}
			sub move01 {
	    if(GetX()>=234)
	    {
	        SetMovePosition02(GetX()-rand(25,50),rand(130,170),60);
	    }
	    else if(GetX()<=204)
	    {
	        SetMovePosition02(GetX()+rand(25,50),rand(130,170),60);
	    }
	    else if(GetX()<=GetPlayerX())
	    {
	        SetMovePosition02(GetX()+rand(25,50),rand(130,170),60);
	    }
	    else if(GetX()>=GetPlayerX())
	    {
	        SetMovePosition02(GetX()-rand(25,50),rand(130,170),60);
	    }
	}
	@DrawLoop{
	  DrawBoss(imgBoss);
		DrawGraphic(GetX(),GetY());
	}
        

}
