#TouhouDanmakufu[Single]
#ScriptVersion[3]
#Title["Med"]

#include"./functions1.txt"

timer = 1000;

@Initialize
{
	objEnemy = ObjEnemy_Create(OBJ_ENEMY_BOSS);
	ObjEnemy_Regist(objEnemy);
	ObjEnemy_SetDamageRate(objEnemy,0,0);
	
	TEnemyWork;
	ObjEnemy_Render;
	TLife(objEnemy,0,20,0,0,0,0,0);
	TEnd;
}

@MainLoop
{
	timer-=1/60;
	yield;
}

@Event
{
	alternative(GetEventType())
	case(EV_REQUEST_LIFE)
		{
		SetScriptResult(1);
		}
	case(EV_REQUEST_TIMER)
		{
		SetScriptResult(timer);
		}
	case(EV_REQUEST_SPELL_SCORE)
		{
		SetScriptResult(30000);
		}
}

task TEnemyWork
{
	TXY;
	loop(45){yield;}
	DeleteShotAll(TYPE_ALL,TYPE_ITEM);
	ObjEnemy_SetLife(objEnemy,0);
}
			

task TMovement
{
	let distM = 50;
	let distm =distM/2;
	let numb = round(rand(0,1))*2-1;
		if(ObjMove_GetX(objEnemy) < 175)
			{
			numb =1;	
			}
		else if (ObjMove_GetX(objEnemy) > GetStgFrameWidth-175)
			{	
			numb = -1;
			}
	ObjMove_SetDestAtWeight(objEnemy,ObjMove_GetX(objEnemy)+numb*rand(distm,distM),rand(90,180),30,5);
		
}