
#Title[12,Ł]
#Text[]
#Image[]
#BGM[.\bgm\.mp3]
#Player[FREE]
#BackGround[User(.\img\, 0, 0)]//384~448 
#ScriptVersion[2]

script_enemy_main {
	let imgExRumia   = GetCurrentScriptDirectory~"img\ExRumia.png";
	let haikei=GetCurrentScriptDirectory~"img\2back.png";
	let counts     =  0;
	let count     =  0;
	let coun      =  0;
	let cou      =  0;
	let angle     =  270;
	let SIN       =  160;
	let h       =  0;

               // ԗΐ򎇐[10`؇AėI |Dې
                let csd        = GetCurrentScriptDirectory;
                let shotData   = csd ~ "kshotData.txt";
                let tam         =csd~"se\counte.wav";
                let tama         =csd~"se\shot10.wav";

	@Initialize {
		CutIn(YOUMU, "Xuv", "", 0, 0, 0, 0);
		SetTimer(32);
		SetScore(10000000);

		SetLife(1000);
		SetDamageRate(25,20);
 
		LoadGraphic(haikei);    
		LoadGraphic(imgExRumia); 
		SetTexture(imgExRumia);
		SetGraphicRect(0, 0, 63, 63);
		LoadUserShotData(shotData);
                SetInvincibility(350);
		SetMovePosition02(GetCenterX,GetClipMinY+170,60);
	}

	@MainLoop {
		SetCollisionA(GetX, GetY, 48);
		SetCollisionB(GetX, GetY, 24);

		counts++;
		count++;
		coun++;
		cou++;
		if(cou==60)
			{
                                PlaySE(tama);	
				cou=56;
			}

		if(coun==1320)
			{
                                PlaySE(tam);	
				coun=1260;
			}


		if(count>=60 && count%4==0){
		loop(6){

		CreateLaserB(01,0,0,PURPLE01,0);
		SetLaserDataB(01,0,0,0,SIN+sin(SIN)*10,angle+sin(SIN)*1000,0,0,0);
		SetShotKillTime(01,1);

		CreateShotA(11,0,0,20);
		SetShotDataA(11,0,1.3,angle+sin(SIN)*1000,-0.1,0,0,99);
		SetShotKillTime(11,0);

                AddShot(0,01,11,0);
                FireShot(01);
		angle+=60;
		}
		angle+=1;
		SIN+=-1;
		}

		if(counts>=60 && counts%4==0){
		loop(6){

		CreateLaserB(01,0,0,PURPLE01,0);
		SetLaserDataB(01,0,0,0,h+sin(h)*10,angle-sin(h)*1000,0,0,0);
		SetShotKillTime(01,1);

		CreateShotA(11,0,0,20);
		SetShotDataA(11,0,1.3,angle+sin(h)*1000,0.1,0,0,39);

                AddShot(0,01,11,0);
                FireShot(01);
		angle+=60;
		}
		angle+=1;
		h+=1;
		}

		if(h==160){
		h=0;
		}

		if(SIN==0){
		SIN=160;
		}


	}
	@DrawLoop {
		SetTexture(imgExRumia);
		if(int(GetSpeedX())==0){SetGraphicRect(64,1,127,64);}
		else if(GetSpeedX()>0){SetGraphicRect(192,1,255,64);}
		else if(GetSpeedX()<0){SetGraphicRect(128,1,191,64);}
		DrawGraphic(GetX, GetY);
	}

	@Finalize {
		DeleteGraphic(imgExRumia);
	}
}