script_enemy_main
{
	let sapz = GetCurrentScriptDirectory ~ "img\suiyy.png";
	let ohgodmakeitstop = GetCurrentScriptDirectory ~ "img\STAIRS\IT KEEPS HAPPENING.png";
	let stairs = GetCurrentScriptDirectory ~ "img\STAIRS\stairs.png";
	let jeff = GetCurrentScriptDirectory ~ "img\STAIRS\jeff.png";
	let text1 = GetCurrentScriptDirectory ~ "img\STAIRS\text1.png";
	let text2 = GetCurrentScriptDirectory ~ "img\STAIRS\text2.png";
	
	let objstairs;
	let objjeff;
	let objtext1;
	let objtext2;
	
	let frame = 0;
	
	@Initialize
	{
		LoadGraphic(sapz);
		LoadGraphic(ohgodmakeitstop);
		LoadGraphic(stairs);
		LoadGraphic(jeff);
		LoadGraphic(text1);
		LoadGraphic(text2);
	
		SetLife(9001);
		ForbidShot(true);
		ForbidBomb(true);
		Expert;
		MagicCircle(false);
		SetRateScoreSystemEnable(false);
		PlayMusic(GetCurrentScriptDirectory ~ "bgm\Beatdown Round 2.mp3");
		SetMovePosition02(GetCenterX, GetCenterY - 120, 10);
		CreateEventFromScript("ABSCOND");
	}

	@MainLoop
	{
		if(frame==1)
		{
			shootingstairs;
			jeffspawn;
		}
		if(frame>20)
		{
			ShootDownPlayer;
		}
		if(frame==120)
		{
			Itoldyoudog;
		}
		if(!OnEvent){frame++;}
		yield;
	}
	
	@DrawLoop
	{
		SetTexture(sapz);
		SetGraphicRect(0, 0, 250, 250);
		SetGraphicAngle(0, 0, 0);
		SetGraphicScale(0.5, 0.5);
		DrawGraphic(GetX, GetY);
	}

	@Finalize
	{
	}
	
	function Wait(frames){loop(frames){yield;}}

	task shootingstairs
	{
		ascent(i in 0..5)
		{
			objstairs = Obj_Create(OBJ_EFFECT);
			Obj_SetCollisionToPlayer(objstairs, true);
			ObjEffect_SetTexture(objstairs, stairs);
			ObjEffect_SetPrimitiveType(objstairs, PRIMITIVE_TRIANGLEFAN);
			ObjEffect_SetScale(objstairs, 0.5, 0.5);
			ObjEffect_CreateVertex(objstairs, 4);
			ObjEffect_SetVertexUV(objstairs, 0, 0, 0);
			ObjEffect_SetVertexUV(objstairs, 1, 287, 0);
			ObjEffect_SetVertexUV(objstairs, 2, 287, 274);
			ObjEffect_SetVertexUV(objstairs, 3, 0, 274);
			ObjEffect_SetVertexXY(objstairs, 0, -287/2, -274/2);
			ObjEffect_SetVertexXY(objstairs, 1, 287/2, -274/2);
			ObjEffect_SetVertexXY(objstairs, 2, 287/2, 274/2);
			ObjEffect_SetVertexXY(objstairs, 3, -287/2, 274/2);
			Obj_SetPosition(objstairs, 600/5*i, -100);
			Obj_SetAngle(objstairs, 100);
			Obj_SetSpeed(objstairs, 20);
		}
		Wait(7);
		shootingstairs;
	}
	
	task jeffspawn /* Make some objects */
	{
		objjeff = Obj_Create(OBJ_EFFECT);
		ObjEffect_SetLayer(objjeff, 8);
		ObjEffect_SetTexture(objjeff, jeff);
		ObjEffect_SetPrimitiveType(objjeff, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_CreateVertex(objjeff, 4);
		ObjEffect_SetVertexUV(objjeff, 0, 0, 0);
		ObjEffect_SetVertexUV(objjeff, 1, 240, 0);
		ObjEffect_SetVertexUV(objjeff, 2, 240, 240);
		ObjEffect_SetVertexUV(objjeff, 3, 0, 240);
		
		objtext1 = Obj_Create(OBJ_EFFECT);
		ObjEffect_SetLayer(objtext1, 8);
		ObjEffect_SetTexture(objtext1, text1);
		ObjEffect_SetPrimitiveType(objtext1, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_CreateVertex(objtext1, 4);
		ObjEffect_SetVertexUV(objtext1, 0, 0, 0);
		ObjEffect_SetVertexUV(objtext1, 1, 235, 0);
		ObjEffect_SetVertexUV(objtext1, 2, 235, 105);
		ObjEffect_SetVertexUV(objtext1, 3, 0, 105);
		ObjEffect_SetVertexXY(objtext1, 0, -235/2, -105/2);
		ObjEffect_SetVertexXY(objtext1, 1, 235/2, -105/2);
		ObjEffect_SetVertexXY(objtext1, 2, 235/2, 105/2);
		ObjEffect_SetVertexXY(objtext1, 3, -235/2, 105/2);
		Obj_SetPosition(objtext1, 265, -100);
		
		objtext2 = Obj_Create(OBJ_EFFECT);
		ObjEffect_SetLayer(objtext2, 8);
		ObjEffect_SetTexture(objtext2, text2);
		ObjEffect_SetPrimitiveType(objtext2, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_CreateVertex(objtext2, 4);
		ObjEffect_SetVertexUV(objtext2, 0, 0, 0);
		ObjEffect_SetVertexUV(objtext2, 1, 250, 0);
		ObjEffect_SetVertexUV(objtext2, 2, 250, 46);
		ObjEffect_SetVertexUV(objtext2, 3, 0, 46);
		ObjEffect_SetVertexXY(objtext2, 0, -250/2, -46/2);
		ObjEffect_SetVertexXY(objtext2, 1, 250/2, -46/2);
		ObjEffect_SetVertexXY(objtext2, 2, 250/2, 46/2);
		ObjEffect_SetVertexXY(objtext2, 3, -250/2, 46/2);
		Obj_SetPosition(objtext2, 385, -100);
	}
	
	task Itoldyoudog
	{
		ObjEffect_SetVertexXY(objjeff, 0, -240/2, -240/2);
		ObjEffect_SetVertexXY(objjeff, 1, 240/2, -240/2);
		ObjEffect_SetVertexXY(objjeff, 2, 240/2, 240/2);
		ObjEffect_SetVertexXY(objjeff, 3, -240/2, 240/2);
		Obj_SetPosition(objjeff, 510, 130);
		descent(i in 0..5)
		{
			ObjEffect_SetScale(objjeff, 1+i*0.02, 1+i*0.02);
			yield;
		}
		descent(i in 0..5)
		{
			Obj_SetPosition(objtext1, 265, 63-i*20);
			yield;
		}
		Wait(110);
		ascent(i in 0..5)
		{
			Obj_SetPosition(objjeff, 510+i*70, 130);
			Obj_SetPosition(objtext1, 265, 63-i*30);
			yield;
		}
		Wait(60);
		
		ObjEffect_SetVertexXY(objjeff, 0, 240/2, -240/2);
		ObjEffect_SetVertexXY(objjeff, 1, -240/2, -240/2);
		ObjEffect_SetVertexXY(objjeff, 2, -240/2, 240/2);
		ObjEffect_SetVertexXY(objjeff, 3, 240/2, 240/2);
		Obj_SetPosition(objjeff, 130, 130);
		descent(i in 0..5)
		{
			ObjEffect_SetScale(objjeff, 1+i*0.02, 1+i*0.02);
			yield;
		}
		descent(i in 0..5)
		{
			Obj_SetPosition(objtext2, 385, 33-i*20);
			yield;
		}
		loop(110)
		{
			Obj_SetPosition(objjeff, 130+rand(0,3), 130+rand(0,3));
			yield;
		}
		ascent(i in 0..5)
		{
			Obj_SetPosition(objjeff, 130-i*70, 130);
			Obj_SetPosition(objtext2, 385, 33-i*20);
			yield;
		}
		Wait(60);
		
		Itoldyoudog;
	}
	
}

script_event ABSCOND 
{
	let zeng = GetCurrentScriptDirectory ~ "img\cutin\pl00_uhh.png";
	let sap = GetCurrentScriptDirectory ~ "img\cutin\sssssssaasagvb.png";

	@Initialize
	{
		LoadGraphic(zeng);
		LoadGraphic(sap);
	}

	@MainLoop
	{
		SetChar(LEFT, zeng);
		SetGraphicRect(LEFT, 0, 0, 225, 250);
		MoveChar(LEFT, FRONT);
		TextOutA("\c[YELLOW]Holy :sword!: this is way too hard...  Screw this I'm outta here!");
		SetChar(RIGHT, sap);
		SetGraphicRect(RIGHT, 1, 1, 300, 316);
		MoveChar(LEFT, BACK);
		MoveChar(RIGHT, FRONT);
		TextOutA("\c[RED]CAN'T ABSCOND, BRO!");
		MoveChar(LEFT, FRONT);
		MoveChar(RIGHT, BACK);
		TextOutA("\c[YELLOW]Wha-");
		End;
	}

	@Finalize
	{
	}

}