//東方弾幕風
//てんしトーク
#ScriptVersion[2]

script_enemy_main{

#include_function".\lib\include_std.txt"
#include_function".\system\include_enemy_boss.txt"

let animation_counter = 0;



let boss_state = _STATE_STAND;

@Initialize{
	SetLife(1);

	SetDamageRate(100,100);
	system_SetEnemyTexture("KANAME");
	system_SetEnemyType(4);
	once_system_LoadResourceBoss();
	system_SetEnemyLife(1000000);
	system_SetEnemyWeight(0);
	system_SetEnemyRadius(-3);
	LoadUserShotData(GetCurrentScriptDirectory() ~ "UserShot_tenshi.txt");
	once_MainRoutine();

}

@MainLoop{

//	SetCollisionA(GetX(), GetY(), 24);
	animation_counter++;
	yield;
}

@DrawLoop{
	if(system_IsInvisible()){return;}

	SetColor(00,00,00);
	SetGraphicScale(1,1);
	SetAlpha(50);

	SetTexture(img_Enemy);
	system_SetGraphicRect(["ROCK_MAIN01","ROCK_MAIN02","ROCK_MAIN03","ROCK_MAIN04"][trunc(animation_counter/5)%4]);
	DrawGraphic(GetX(), GetY());

	SetTexture(img_EnemyBoss);
	system_SetGraphicRect(["BOSS_MAIN01","BOSS_MAIN02","BOSS_MAIN03","BOSS_MAIN04"][trunc(animation_counter/4)%4]);
	DrawGraphic(GetX(), GetY()-48);

}

@Finalize{

}


task once_MainRoutine(){
	boss_state = _STATE_STAND;
//	once_system_TaskDrawTenshi();
	once_system_TaskSphereParameterChecker();
//	once_system_TaskSphereHitTest();
	once_system_EnemyMain();
	once_MoveRoutine();
}


task once_MoveRoutine(){

	SetMovePosition03(GetCenterX(), GetCenterY()-70, 15, 15);
	loop(10){yield;}
	while(GetSpeed()>0){ yield; }

	loop(200){yield;}
	//while(GetEnemyNum() > 1){ yield; }
	loop(1440){yield;}

	SetMovePosition03(GetClipMaxX()+50, GetCenterY()-140, 15, 15);
	loop(10){yield;}
	while(GetSpeed()>0){ yield; }



}//end task


}//end script

