//“Œ•û’e–‹•—
//enemy01
#ScriptVersion[2]

script_enemy_main{

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

let animation_counter = 0;

@Initialize{

	SetDamageRate(100,100);
	system_SetEnemyTexture("TYPE02");
	system_SetEnemyType(2);
	once_system_LoadResource();
	system_SetEnemyLife(10);
	system_SetEnemyWeight(10*3);
	system_SetEnemyRadius(30);
	once_MainRoutine();
}

@MainLoop{
	SetCollisionA(GetX(), GetY(), 24);
	animation_counter++;
	yield;
}

@DrawLoop{
	if(system_IsInvisible()){return;}
	SetTexture(img_Enemy);
	SetGraphicScale(1.0,1.0);
	system_SetGraphicRect(["SPHERE_MAIN01","SPHERE_MAIN02","SPHERE_MAIN03","SPHERE_MAIN04"][trunc(animation_counter/4)%4]);
	DrawGraphic(GetX(), GetY());
}


@Finalize{

}


task once_MainRoutine(){
	once_system_TaskSphereParameterChecker();
	once_system_TaskSphereHitTest();
	once_system_EnemyMain();
	once_MoveRoutine();
}

task once_MoveRoutine(){

	system_MoveTypeSelect();
	system_StartMove();

	loop(40){yield;}

	let ang = GetAngleToPlayer();
	ascent(i in 0..6){
		if(system_IsInvisible()){ break; }
		ascent(j in 0..5){
			let id = 0;
			let spd = 1.2 + 0.3 * (j/4);
			CreateShotA(id, GetX(), GetY(), 10);
			SetShotDataA(id, 0, spd + 3, ang -25 + 50* (j/4), 0, -0.2, spd, RED01);
			SetShotDataA(id, 60, spd, NULL, 0, 0, spd, NULL);
			FireShot(id);
		}
		loop(10){yield;}
	}


	system_StopMove();
	yield;
	system_StartMove();


}//end task

}

