e
#Title[Hʏ]
#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() + 130,20,4);
		SetDamageRate(200,100);
		SetCollisionEx(32,16,false,60);
		SetEnemyMarker(true);
		
		TMain();
	}
	
	@MainLoop{
		yield;
	}
	
	@DrawLoop{
		DrawBoss(imgBoss_Yuuka);
	}
	
	@Finalize{
		FinalizeData();
	}
	
	task TMain(){
		Wait(60);
		
		SetTimer(55);
		
		Atack();
	}
	
	task Atack(){
		let angle = rand(0,360);
		
		Leaf(4.7,angle      ,YELLOW01,115,0);
		Leaf(4.7,angle + 180,GREEN01 ,116,2);
	}
	
	task Leaf(roll,angle,graph,graph2,swait){
		let x = GetX();
		let y = GetY();
		
		let px = GetX();
		let py = GetY();
		
		let rad = 0;
		let count = swait;
		
		loop{
			px = GetX();
			py = GetY();
			
			x = GetGapX(px,rad,angle);
			y = GetGapY(py,rad,angle);
			
			GrowEffect2(x,y,graph,30);
			
			if(count % 2 == 0){
				ascent(i in 0..4){
					CreateShot01(x,y,2.4 + i * 0.4,angle - 140,graph2,0);
				}
			}
			
			if(count != 0 && count % 70 == 0){
				SetMovePositionRandom01(rand(20,40),rand(20,40),rand(2,3),32 + 50,16 + 30,416 - 50,146 + 30);
			}
			
			angle += roll;
			
			if(rad < 60){
				rad += 1;
			}
			
			count += 1;
			
			yield;
		}
	}
	
	task GrowEffect2(x,y,graph,delay){
		let obj = CreateObjShot(x,y,0,0,graph,delay);
		
		yield;
		yield;
		
		if( !Obj_BeDeleted(obj) ){
			Obj_Delete(obj);
		}
	}
	
	#include_function ".\initialize_boss.txt"
	#include_function ".\lib\lib_anime_yuka.txt"
	
	#include_function ".\lib\lib_obj.txt"
	#include_function ".\lib\lib_value.txt"
}