e
#Title[Ăʏ]
#Text[]
#BGM[.\bgm\bgm.wav]
#BackGround[User]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main{
	
	@Initialize{
		InitializeData();
		InitializeAction();
		LoadUserShotData(shot_all);
		
		SetLife(5000);
		SetMovePosition03(GetCenterX(),GetClipMinY() + 110,20,4);
		SetDamageRate(250,100);
		SetCollisionEx(32,16,false,60);
		SetEnemyMarker(true);
		
		TMain();
	}
	
	@MainLoop{
		yield;
	}
	
	@DrawLoop{
		DrawBoss(imgBoss_Tewi);
	}
	
	@Finalize{
		FinalizeData();
	}
	
	task TMain(){
		Wait(60);
		
		SetTimer(55);
		
		Atack();
		Move();
	}
	
	task Atack(){
		let angle = 145 + rand(0,30);
		
		loop{
			Carrot(angle);
			
			angle += 37;
			
			Wait(6);
		}
	}
	
	task Carrot(angle){
		ShotGun(GetX(),GetY(),5  ,angle,10,0,5,1,4);
		ShotGun(GetX(),GetY(),3,angle,20,0,3,1,8);
	}
	
	function ShotGun(x,y,speed,angle,graph,delay,num,way,span){
		let ang = 0;
		let spd = speed;
		let cspd = -speed / (num * 2);
		
		loop(num){
			ang = angle - ( way - 1 ) / 2 * span;
			ascent(i in 0..way){
				CreateShot01(x,y,speed,ang,graph,delay);
				
				ang += span;
			}
			way += 1;
			speed += cspd;
		}
	}
	
	task Move(){
		loop{
			Wait(90);
			
			SetMovePositionRandom01(rand(15,50),rand(15,50),rand(3,4),32 + 50,16 + 30,416 - 50,146 + 30);
		}
	}
	
	#include_function ".\initialize_boss.txt"
	#include_function ".\lib\lib_anime_tewi.txt"
	
	#include_function ".\lib\lib_obj.txt"
	#include_function ".\lib\lib_value.txt"
}