script_enemy_main {
#include_function ".\lib.txt"
let imgAngle=0;
let Orreries = [csd~"img/Orreries0.png", csd~"img/Orreries1.png", csd~"img/Orreries2.png", csd~"img/Orreries3.png", csd~"img/Orreries4.png", csd~"img/Orreries5.png"];
let target1 = 0; let target2 = 0;
@Initialize{
    SetLife(10);
    LoadStuff;
	ascent (i in 0..6){
		LoadGraphic(Orreries[i]);
		}
	LoadUserShotData(GetCurrentScriptDirectory~"Shot.txt");
	MainTask;
	}
@MainLoop{
    yield;
	}
@DrawLoop{
    SetAlpha(255);
	SetColor(255,255,255);
	SetGraphicAngle(0,0,imgAngle);
	SetTexture(Orreries[GetArgument]);
	SetGraphicRect(0,0,64,64);
	SetGraphicScale(0.5,0.5);
	DrawGraphic(GetX,GetY);
	}
@Finalize{
	DeleteStuff;
	}
task MainTask{
	TargetVar;
	OrreriesAttack;
	MovementHex;
	}
task OrreriesAttack{
	if (GetArgument==0){
		let angle = 90;
		loop{
			CreateShotA(0, GetX, GetY, 0);
			SetShotDataA(0, 3, 2.5, angle,0.5,0,0,135);
			FireShot(0);
			angle+=30;
			yield;
			}
		}
	if (GetArgument==1){
	let angle = 0;
		loop{loop(36){
			CreateShot01(GetX + 60*cos(angle), GetY + 60*sin(angle), 3, angle, 139, 12);
			angle += 360/36;
			}
		angle += 4;
		Wait(24);
		}}
	if (GetArgument==2){
	let angle = 0;
		loop{loop(36){
			CreateShot01(GetX + 60*cos(angle), GetY + 60*sin(angle), 3, 180-angle, 143, 12);
			angle += 360/36;
			}
		angle += 4;
		Wait(36*2);
		}}
	if (GetArgument==3){
		loop{
			AimedBullet(1);
			AimedBullet(2);
			AimedBullet(3);
			Wait(60);
			}
		}
	if (GetArgument==4){
		loop{
			TrapBullet(1,1);
			TrapBullet(1,2);
			TrapBullet(1,3);
			TrapBullet(-1,1);
			TrapBullet(-1,2);
			TrapBullet(-1,3);
			Wait(10);
			}
		}
	if (GetArgument==5){
		loop{
			CreateLaserB(0, 700, 10, 8, 60);
			CreateLaserB(1, 700, 10, 8, 60);
			SetLaserDataB(0, 0, 0, 100, 0, GetAngleToPlayer-45, 0.05, GetAngleToPlayer, 0.05);
			SetLaserDataB(1, 0, 0, 100, 0, GetAngleToPlayer+45, -0.05, GetAngleToPlayer, -0.05);
			SetShotKillTime(0, 180);
			SetShotKillTime(1, 180);
			FireShot(0);
			FireShot(1);
			Wait(240);
			}
		}
	}
task AimedBullet(speed){
	let obj=Obj_Create(OBJ_SHOT);
	Obj_SetPosition(obj, GetX, GetY);
    Obj_SetAngle(obj, GetRelativeAngleToPlayer(Obj_GetX(obj),Obj_GetY(obj)));
    Obj_SetSpeed(obj, speed);
    ObjShot_SetGraphic(obj, 147);
    ObjShot_SetDelay  (obj, 0);
    ObjShot_SetBombResist (obj, false);
	while(Obj_BeDeleted(obj)==false) {
		yield;
		}
	}
task TrapBullet(side, speed){
	let obj=Obj_Create(OBJ_SHOT);
	Obj_SetPosition(obj, GetX, GetY);
    Obj_SetAngle(obj, GetRelativeAngleToPlayer(Obj_GetX(obj),Obj_GetY(obj))+30*side);
    Obj_SetSpeed(obj, speed);
    ObjShot_SetGraphic(obj, 137);
    ObjShot_SetDelay  (obj, 0);
    ObjShot_SetBombResist (obj, false);
	while(Obj_BeDeleted(obj)==false) {
		yield;
		} 
	}
task MovementHex{loop{
	SetMovePosition02(GetCenterX+target1, GetCenterY-80+target2, 240);
	Wait(240);
	}}
task TargetVar{loop{
	target1 = -60; target2 = 80;
	Wait(240);
	target1 = 60; target2 = 80;
	Wait(240);
	target1 = 100; target2 = 0;
	Wait(240);
	target1 = 60; target2 = -80;
	Wait(240);
	target1 = -60; target2 = -80;
	Wait(240);
	target1 = -100; target2 = 0;
	Wait(240);
	}}
}