#TouhouDanmakufu
#Title[Tokiko - Hard]
#Player[FREE]
#BackGround[User(.\PIC\black.png, 1, 1)]
#ScriptVersion[2]

script_enemy_main{

	#include_function ".\TokikoData.txt";
	let Counter = 0;
	let Angle = 110;
	let Distance = 50;
	let radiant = 0;
	let GoAway = false;
	let all = 0;
	let gy = 0;
	let shots = [1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2];
	
	sub Shot{
		PlaySE(GetCurrentScriptDirectory~"shot.wav");
	}

	task start{
		yield;
		LoadMusic(GetCurrentScriptDirectory~"nakewameke.mp3");
		yield;
		PlayMusic(GetCurrentScriptDirectory~"nakewameke.mp3");
		loop(120){yield;}
		let Dis = 10;
		loop(70){
			Dis++;
			loop(4){
				Distance = Dis + (Dis/2)*sin(radiant);
				Angle += 3 + sin(radiant);
				radiant += 5;
				Counter++;
				CreateShotA(0, GetX + Distance*cos(Angle), GetY + Distance*sin(Angle), 20);
				SetShotDataA(0, 0, 7, Angle, 0, -0.2, rand(1.6, 1), shots[Counter%12]);
				FireShot(0);
				CreateShotA(0, GetX + Distance*cos(-Angle*2), GetY + Distance*sin(-Angle*2), 20);
				SetShotDataA(0, 0, 7, -Angle*2, 0, -0.2, rand(0.6, 1), shots[Counter%12]);
				FireShot(0);
			}
			Shot;
			yield;
		}
		SetBezierMove01(GetX, GetY, rand(104, 144), rand(100, 140), 50, 50, 40);
		loop(60){yield;}
		SetBezierMove01(GetX, GetY, rand(304, 344), rand(100, 140), 50, -100, 50);
		let Dis = 10;
		loop(70){
			Dis++;
			loop(3){
				Distance = Dis + (Dis/2)*sin(radiant);
				Angle += 3 + sin(radiant);
				radiant += 5;
				Counter++;
				CreateShotA(0, GetX + Distance*cos(Angle), GetY + Distance*sin(Angle), 20);
				SetShotDataA(0, 0, 7, Angle, 0, -0.2, rand(1.6, 1), shots[Counter%12]);
				FireShot(0);
				CreateShotA(0, GetX + Distance*cos(-Angle*2), GetY + Distance*sin(-Angle*2), 20);
				SetShotDataA(0, 0, 7, -Angle*2, 0, -0.2, rand(0.6, 1), shots[Counter%12]);
				FireShot(0);
			}
			Shot;
			yield;
		}
		SetBezierMove01(GetX, GetY, rand(104, 144), rand(100, 140), 50, -100, 50);
		let Dis = 10;
		loop(70){
			Dis++;
			loop(3){
				Distance = Dis + (Dis/2)*sin(radiant);
				Angle += 3 + sin(radiant);
				radiant += 5;
				Counter++;
				CreateShotA(0, GetX + Distance*cos(Angle), GetY + Distance*sin(Angle), 20);
				SetShotDataA(0, 0, 7, Angle, 0, -0.2, rand(1.6, 1), shots[Counter%12]);
				FireShot(0);
				CreateShotA(0, GetX + Distance*cos(-Angle*2), GetY + Distance*sin(-Angle*2), 20);
				SetShotDataA(0, 0, 7, -Angle*2, 0, -0.2, rand(0.6, 1), shots[Counter%12]);
				FireShot(0);
			}
			Shot;
			yield;
		}
		loop(20){yield;}
		SetBezierMove01(GetX, GetY, 224, 100, 50, 50, 30);
		loop(40){yield;}
		let an = rand(0, 360);
		loop(6){
			loop(24){
				GlowShot(GetX, GetY, an, 2);
				an+=360/24;
			}
			Shot;
			loop(20){yield;}
			an-=360/36;
		}
		loop(6){
			loop(24){
				GlowShot(GetX, GetY, an, 2);
				an-=360/24;
			}
			Shot;
			loop(20){yield;}
			an+=360/36;
		}
		loop(40){yield;}
		an = rand(0, 360);
		ShootShit;
		ascent(i in 0..12){
			loop(18){
				CreateShot01(GetX + 30*cos(an+i*2), GetY + 30*sin(an+i*2), 1.4 + i*0.05, an + i, 2, 10);
				an+=360/18;
			}
			Shot;
			yield;yield;
		}
		loop(5){yield;}
		an-=360/9;
		ascent(i in 0..12){
			loop(18){
				CreateShot01(GetX + 30*cos(an+i*2), GetY + 30*sin(an+i*2), 1.4 + i*0.05, an - i, 2, 10);
				an+=360/18;
			}
			Shot;
			yield;yield;
		}
		SetBezierMove01(GetX, GetY, 134, 150, 50, 50, 30);
		loop(50){yield;}
		loop(3){
			GlowShot(GetX, GetY, GetAngleToPlayer, 3);
			GlowShot(GetX, GetY, GetAngleToPlayer + 15, 3);
			GlowShot(GetX, GetY, GetAngleToPlayer - 15, 3);
			Shot;
			loop(12){yield;}
		}
		SetBezierMove01(GetX, GetY, 380, 120, 100, -80, 90);
		loop(10){yield;}
		an = rand(0, 360);
		ascent(i in 0..12){
			loop(18){
				CreateShot01(GetX + 30*cos(an+i*2), GetY + 30*sin(an+i*2), 1.4 + i*0.05, an + i, 2, 10);
				an+=360/18;
			}
			Shot;
			yield;
		}
		loop(5){yield;}
		an-=360/9;
		ascent(i in 0..12){
			loop(18){
				CreateShot01(GetX + 30*cos(an+i*2), GetY + 30*sin(an+i*2), 1.4 + i*0.05, an - i, 2, 10);
				an+=360/18;
			}
			Shot;
			yield;
		}
		loop(20){yield;}
		loop(3){
			GlowShot(GetX, GetY, GetAngleToPlayer, 3);
			GlowShot(GetX, GetY, GetAngleToPlayer + 15, 3);
			GlowShot(GetX, GetY, GetAngleToPlayer - 15, 3);
			Shot;
			loop(12){yield;}
		}
		SetBezierMove01(GetX, GetY, 124, 100, 100, 80, 150);
		loop(27){yield;}
		loop(3){
			GlowShot(GetX, GetY, GetAngleToPlayer, 3);
			GlowShot(GetX, GetY, GetAngleToPlayer + 15, 3);
			GlowShot(GetX, GetY, GetAngleToPlayer - 15, 3);
			Shot;
			loop(12){yield;}
		}
		loop(10){yield;}
		an = rand(0, 360);
		ascent(i in 0..12){
			loop(18){
				CreateShot01(GetX + 30*cos(an+i*2), GetY + 30*sin(an+i*2), 1.4 + i*0.05, an + i, 2, 10);
				an+=360/18;
			}
			Shot;
			yield;
		}
		loop(5){yield;}
		loop(3){
			GlowShot(GetX, GetY, GetAngleToPlayer, 3);
			GlowShot(GetX, GetY, GetAngleToPlayer + 15, 3);
			GlowShot(GetX, GetY, GetAngleToPlayer - 15, 3);
			Shot;
			loop(12){yield;}
		}
		an-=360/9;
		ascent(i in 0..12){
			loop(18){
				CreateShot01(GetX + 30*cos(an+i*2), GetY + 30*sin(an+i*2), 1.4 + i*0.05, an - i, 2, 10);
				an+=360/18;
			}
			Shot;
			yield;
		}
		loop(20){yield;}
		loop(3){
			GlowShot(GetX, GetY, GetAngleToPlayer, 3);
			GlowShot(GetX, GetY, GetAngleToPlayer + 15, 3);
			GlowShot(GetX, GetY, GetAngleToPlayer - 15, 3);
			Shot;
			loop(12){yield;}
		}
		loop(20){yield;}
		an = GetAngleToPlayer;
		loop(48){
			CreateShot01(GetX, GetY, 3.2, an, 2, 0);
			CreateShot01(GetX, GetY, 3, an + 3.75, 1, 0);
			an+=360/48;
		}
		Shot;
		loop(20){yield;}
		MoveYouLittleShit;
		loop(20){yield;}
		loop(9){
			loop(10){
				loop(24){
					ascent(i in 0..4){
						CreateShotA(0, GetX, GetY, 0);
						SetShotDataA(0, 0, 5, an + i, 0, -0.1, 3, i%2 + 1);
						FireShot(0);
					}
					an+=360/24;
				}
				Shot;
				loop(12){yield;}
			}
			an=GetAngleToPlayer;
			Shot;
			loop(12){
				GlowShot(GetX, GetY, an, 2);
				an+=360/12;
			}
			an = rand(0, 360);
		}
		loop(30){yield;}
		let dcounter = 0;
		let hh = 37;
		loop(380){
			dcounter++;
			if(dcounter%hh==0){
				an = GetAngleToPlayer;
				loop(24){
					CreateShot01(GetX, GetY, 3.2, an, 2, 0);
					CreateShot01(GetX, GetY, 3, an + 7.5, 1, 0);
					an+=360/24;
				}
				Shot;
				if(hh>3){
					hh--;
				}
			}
			yield;
		}
		SetScore(100000);
		CutIn(YOUMU, "Spellbind "\""Blinding Labyrinth"\", "", 0, 0, 0, 0);
		SetTimer(120);
		SetCommonData("HB", 400);
		EXPLODE;
		loop(100){yield;}
		SetMovePosition03(224, 120, 10, 3);
		loop(70){yield;}
		SetShotAutoDeleteClip(200, 200, 200, 200);
		hh = 12;
		an = rand(0, 360);
		loop(100){
			loop(3){
				CreateShot01(GetX + 50*cos(an), GetY + 50*sin(an), 3, an, 9, 20);
				CreateShot01(GetX + 50*cos(an + 120), GetY + 50*sin(an + 120), 3, an + 120, 9, 20);
				CreateShot01(GetX + 50*cos(an + 240), GetY + 50*sin(an + 240), 3, an + 240, 9, 20);
			}
			yield;yield;
			an+=hh;
			hh+=0.1;
			CreateShot01(100 + rand(-30, 50), 100 + rand(-60, 60), rand(2, 4), 90 + rand(-20, 20), 4, 20);
			CreateShot01(100 + rand(-30, 50), 100 + rand(-60, 60), rand(2, 4), 270 + rand(-20, 20), 4, 20);
			loop(3){
				CreateShot01(GetX + 50*cos(an), GetY + 50*sin(an), 3, an, 9, 20);
				CreateShot01(GetX + 50*cos(an + 120), GetY + 50*sin(an + 120), 3, an + 120, 9, 20);
				CreateShot01(GetX + 50*cos(an + 240), GetY + 50*sin(an + 240), 3, an + 240, 9, 20);
			}
			yield;yield;
			an+=hh;
			hh+=0.1;
			CreateShot01(348 + rand(-30, 50), 100 + rand(-60, 60), rand(2, 4), 90 + rand(-20, 20), 4, 20);
			CreateShot01(348 + rand(-30, 50), 100 + rand(-60, 60), rand(2, 4), 270 + rand(-20, 20), 4, 20);
		}
		lasers;
		loop(140){
			loop(3){
				CreateShot01(GetX + 50*cos(an), GetY + 50*sin(an), 3, an, 9, 20);
				CreateShot01(GetX + 50*cos(an + 120), GetY + 50*sin(an + 120), 3, an + 120, 9, 20);
				CreateShot01(GetX + 50*cos(an + 240), GetY + 50*sin(an + 240), 3, an + 240, 9, 20);
			}
			yield;yield;
			an+=hh;
			hh+=0.1;
			CreateShot01(100 + rand(-30, 50), 100 + rand(-60, 60), rand(2, 4), 90 + rand(-20, 20), 4, 20);
			CreateShot01(100 + rand(-30, 50), 100 + rand(-60, 60), rand(2, 4), 270 + rand(-20, 20), 4, 20);
			loop(3){
				CreateShot01(GetX + 50*cos(an), GetY + 50*sin(an), 3, an, 9, 20);
				CreateShot01(GetX + 50*cos(an + 120), GetY + 50*sin(an + 120), 3, an + 120, 9, 20);
				CreateShot01(GetX + 50*cos(an + 240), GetY + 50*sin(an + 240), 3, an + 240, 9, 20);
			}
			yield;yield;
			an+=hh;
			hh+=0.1;
			CreateShot01(348 + rand(-30, 50), 100 + rand(-60, 60), rand(2, 4), 90 + rand(-20, 20), 4, 20);
			CreateShot01(348 + rand(-30, 50), 100 + rand(-60, 60), rand(2, 4), 270 + rand(-20, 20), 4, 20);
		}
		SetMovePosition03(224, 200, 10, 3);
		SetDamageRate(100, 10);
	}
	
	task ShootShit{
		loop(10){
			loop(34){yield;}
			let agh = rand(0, 360);
			Shot;
			loop(48){
				CreateShot01(GetX, GetY, 2.2, agh, 1, 0);
				agh+=360/48;
			}
		}
	}
			
	task lasers{
		let lol = 30;
		let hj = 2;
		loop(12){
			OptionFirst(-45, 180, hj, lol, rand(0, 360), 4);
			hj+=0.195;
			loop(5){yield;}
			OptionSecond(-135, 0, hj, lol, rand(0, 360), -4);
			hj+=0.195;
			lol--;
			loop(5){yield;}
		}
		let angle = 0;
		loop(46){
			OptionFirst(-45 + 10*sin(angle), 180 + 10*sin(angle), hj, lol, rand(0, 360), 4);
			loop(5){yield;}
			angle+=10;
			OptionSecond(-135 + 10*sin(angle), 0 + 10*sin(angle), hj, lol, rand(0, 360), -4);
			loop(5){yield;}
			angle+=10;
		}
		loop(40){yield;}
		loop(4){
			let an = rand(0, 36);
			loop(12){
				GlowShot(GetX, GetY, an, 4);
				an+=360/12;
			}
			loop(20){yield;}
		}
		let an = 270;
		loop(7){
			OptionMain(an, 30);
			an+=360/7;
		}
		loop(20){yield;}
		glowy;
		loop{
			loop(3){
				an = rand(0, 36);
				loop(32){
					CreateShot01(GetX + 30*cos(an), GetY + 30*sin(an), 1, an, 10, 10);
					an+=360/32;
				}
				loop(20){yield;}
			}
			an = rand(0, 36);
			loop(16){
				ascent(i in 0..6){ 
					CreateShot01(GetX + 30*cos(an), GetY + 30*sin(an), 1, an + i*2, 10, 10);
				}
				an+=360/16;
			}
			loop(20){yield;}
		}
	}
	
	task glowy{
		loop(1240){yield;}
		MovementFuck;
		loop(8){
			loop(50){yield;}
			let an = GetAngleToPlayer;
			loop(12){
				GlowShot(GetX, GetY, an, 2);
				an+=360/12
			}
			loop(80){yield;}
			let an = GetAngleToPlayer;
			loop(12){
				GlowShot(GetX, GetY, an, 2);
				an+=360/12
			}
			loop(20){yield;}
			let an = GetAngleToPlayer;
			loop(12){
				GlowShot(GetX, GetY, an, 2);
				an+=360/12
			}
			loop(60){yield;}
			let an = GetAngleToPlayer;
			loop(12){
				GlowShot(GetX, GetY, an, 2);
				an+=360/12
			}
			loop(80){yield;}
			let an = GetAngleToPlayer;
			loop(12){
				GlowShot(GetX, GetY, an, 2);
				an+=360/12
			}
			loop(30){yield;}
		}
	}
	
	task MovementFuck{
	let anglee = 90;
	let jk = 0;
		loop{
			SetX(224 + jk*cos(anglee));
			SetY(170 + 30*sin(anglee));
			anglee+=0.7;
			if(jk<80){
				jk+=0.25;
			}
			yield;
		}
	}
	
	task EXPLODE{
		let obj = Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(obj, GetCurrentScriptDirectory~"explode.png");
		ObjEffect_SetRenderState(obj, ADD);
		ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_CreateVertex(obj, 4);
		ObjEffect_SetVertexUV(obj, 0, 0, 0);
		ObjEffect_SetVertexUV(obj, 1, 255, 0);
		ObjEffect_SetVertexUV(obj, 2, 255, 255);
		ObjEffect_SetVertexUV(obj, 3, 0, 255);
		let x = GetX;
		let y = GetY;
		let alpha = 255;
		let rad = 20;
		let ral = 15;
		let angle = rand(0, 360);
		loop(51){
			ascent(i in 0..4){
				ObjEffect_SetVertexXY(obj, i, x + rad*cos(angle + i*90), y + rad*sin(angle + i*90));
				ObjEffect_SetVertexColor(obj, i, alpha, 255, 255, 255);
			}
			alpha-=5;
			rad+=ral;
			ral/=0.95;
			angle = rand(0, 360);
			yield;
		}
		Obj_Delete(obj);
	}
	task MoveYouLittleShit{
		let gang = 180;
		let gh = 3;
		loop(1060){
			SetX(224 + 100*cos(gang));
			SetY(100 + 30*sin(gang));
			gang+=gh;
			gh+=0.0025;
			yield;
		}
		let dii = 100;
		let gl = 30;
		let cen = 100;
		loop(300){
			SetX(224 + dii*cos(gang));
			SetY(cen + gl*sin(gang));
			gang+=gh;
			gl-=0.1;
			dii-=0.333333;
			gh+=0.0025;
			cen+=0.333333;
			yield;
		}
	}
	
	task bullets(angle){
		halo(GetX, GetY, angle, 10);
		let ra = rand(0, 360);
		let dis = 0;
		loop(40){
			loop(2){
				dis+=5;
				CreateShotA(0, GetX + dis*cos(angle), GetY + dis*sin(angle), 10);
				SetShotDataA(0, 0, 0, ra, 0, 0.02, 1.2, 3);
				FireShot(0);
				ra+=10;
			}
			yield;
		}
	}
	@Initialize{
		LoadUserShotData(GetCurrentScriptDirectory~"tokikoshots.txt");
		LoadGraphic(GetCurrentScriptDirectory~"tokikosprite.png");
		LoadGraphic(GetCurrentScriptDirectory~"alphaparticle2.png");
		LoadGraphic(GetCurrentScriptDirectory~"light.png");
		LoadGraphic(GetCurrentScriptDirectory~"halo.png");
		LoadGraphic(GetCurrentScriptDirectory~"explode.png");
		LoadGraphic(GetCurrentScriptDirectory~"MagicCircle.png");
		LoadGraphic(GetCurrentScriptDirectory~"circle.png");
		LoadGraphic(GetCurrentScriptDirectory~"LAZERBEAM2.png");
		LoadGraphic(GetCurrentScriptDirectory~"LAZERBEAM3.png");
		LoadGraphic(GetCurrentScriptDirectory~"LaserBlast.png");
		SetLife(6000);
		SetDamageRate(5, 5);
		SetY(30);
		SetX(0);
		SetMovePosition03(224, 100, 10, 3);
		SetCommonData("HB", -4000);
		start;
	}
	
	@MainLoop{
		SetCollisionA(GetX, GetY, 32);
		SetCollisionA(GetX, GetY, 16);
		RunEveryFrame;
		SetCommonData("HB", GetCommonData("HB") + 1);
		all+=2;
		yield;
	}
	
	@DrawLoop{
		DrawTokiko;
	}
	
	@Finalize{
		DeleteGraphic(GetCurrentScriptDirectory~"tokikosprite.png");
	}
	
	task GlowShot(x, y, angle, velocity){
		let obj = Obj_Create(OBJ_SHOT);
		Obj_SetPosition(obj, x, y);
		Obj_SetSpeed(obj, velocity);
		Obj_SetAngle(obj, angle);
		ObjShot_SetGraphic(obj, 5);
		let objj = Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(objj, GetCurrentScriptDirectory~"alphaparticle2.png");
		ObjEffect_SetRenderState(objj, ADD);
		ObjEffect_SetPrimitiveType(objj, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_CreateVertex(objj, 4);
		ObjEffect_SetVertexUV(objj, 0, 0, 0);
		ObjEffect_SetVertexUV(objj, 1, 63, 0); 
		ObjEffect_SetVertexUV(objj, 2, 63, 63);
		ObjEffect_SetVertexUV(objj, 3, 0, 63);
		ObjEffect_SetVertexXY(objj, 0, -32, -32);
		ObjEffect_SetVertexXY(objj, 1, 32, -32); 
		ObjEffect_SetVertexXY(objj, 2, 32, 32);
		ObjEffect_SetVertexXY(objj, 3, -32, 32);
		ascent(i in 0..4){
			ObjEffect_SetVertexColor(objj, i, 255, 128, 255, 255);
		}
		let a = 0;
		while(!Obj_BeDeleted(obj)){
			Obj_SetSpeed(obj, velocity + sin(a/2));
			Obj_SetPosition(objj, Obj_GetX(obj), Obj_GetY(obj));
			ObjEffect_SetAngle(objj, 0, 0, rand_int(0, 359));
			ObjEffect_SetScale(objj, 1.5 + sin(a)/3, 1.5 + sin(a)/3);
			a+=10;
			yield;
		}
		Obj_Delete(objj);
	}
	
	task OptionFirst(an, angle, lol, lol2, aaaa, aaaa2){
		let opt = Obj_Create(OBJ_EFFECT);
		Obj_SetPosition(opt, GetX, GetY);
		Obj_SetSpeed(opt, 6);
		Obj_SetAngle(opt, an);
		ObjEffect_SetTexture(opt, GetCurrentScriptDirectory~"circle.png");
		ObjEffect_SetRenderState(opt, ALPHA);
		ObjEffect_SetLayer(opt, 2);
		ObjEffect_SetPrimitiveType(opt, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_CreateVertex(opt, 4);
		ObjEffect_SetVertexUV(opt, 0, 0, 0);
		ObjEffect_SetVertexUV(opt, 1, 255, 0); 
		ObjEffect_SetVertexUV(opt, 2, 255, 255);
		ObjEffect_SetVertexUV(opt, 3, 0, 255);
		ObjEffect_SetVertexXY(opt, 0, -32, -32);
		ObjEffect_SetVertexXY(opt, 1, 32, -32); 
		ObjEffect_SetVertexXY(opt, 2, 32, 32);
		ObjEffect_SetVertexXY(opt, 3, -32, 32);
		loop(21){
			Obj_SetSpeed(opt, Obj_GetSpeed(opt)-0.02);
			Obj_SetAngle(opt, Obj_GetAngle(opt)+5);
			ObjEffect_SetScale(opt, 1 + 0.1*sin(aaaa), 1 + 0.1*sin(aaaa));
			ObjEffect_SetAngle(opt, 0, 0, aaaa);
			aaaa+=aaaa2;
			yield;
		}
		loop(lol2){yield;
			ObjEffect_SetScale(opt, 1 + 0.1*sin(aaaa), 1 + 0.1*sin(aaaa));
			ObjEffect_SetAngle(opt, 0, 0, aaaa);
			aaaa+=aaaa2;
			Obj_SetSpeed(opt, Obj_GetSpeed(opt)+0.02);}
		let g = 0;
		let counter = 0;
		let obj = Obj_Create(OBJ_LASER);
		Obj_SetPosition(obj, GetX, GetY);
		Obj_SetAngle(obj, angle);
		Obj_SetSpeed(obj, 0);
		ObjShot_SetGraphic(obj, 6);
		ObjLaser_SetSource(obj, false);
		ObjLaser_SetWidth(obj, 64);
		ObjLaser_SetLength(obj, 0);
		let objj = Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(objj, GetCurrentScriptDirectory~"light.png");
		ObjEffect_SetRenderState(objj, ADD);
		ObjEffect_SetPrimitiveType(objj, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_CreateVertex(objj, 4);
		ascent(i in 0..4){
			ObjEffect_SetVertexColor(objj, i, 255, 200, 25, 255);
		}
		ObjEffect_SetVertexUV(objj, 0, 0, 0);
		ObjEffect_SetVertexUV(objj, 1, 255, 0); 
		ObjEffect_SetVertexUV(objj, 2, 255, 255);
		ObjEffect_SetVertexUV(objj, 3, 0, 255);
		ObjEffect_SetVertexXY(objj, 0, -128, -128);
		ObjEffect_SetVertexXY(objj, 1, 128, -128); 
		ObjEffect_SetVertexXY(objj, 2, 128, 128);
		ObjEffect_SetVertexXY(objj, 3, -128, 128);
		let objj2 = Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(objj2, GetCurrentScriptDirectory~"LaserBlast.png");
		ObjEffect_SetRenderState(objj2, ADD);
		ObjEffect_SetPrimitiveType(objj2, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_CreateVertex(objj2, 4);
		ObjEffect_SetVertexUV(objj2, 0, 0, 0);
		ObjEffect_SetVertexUV(objj2, 1, 115, 0); 
		ObjEffect_SetVertexUV(objj2, 2, 115, 113);
		ObjEffect_SetVertexUV(objj2, 3, 0, 113);
		ObjEffect_SetVertexXY(objj2, 0, -48, -48);
		ObjEffect_SetVertexXY(objj2, 1, 48, -48); 
		ObjEffect_SetVertexXY(objj2, 2, 48, 48);
		ObjEffect_SetVertexXY(objj2, 3, -48, 48);
		ObjEffect_SetAngle(objj2, 0, 0, angle + 90);
		let objjj = Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(objjj, GetCurrentScriptDirectory~"LAZERBEAM3.png");
		ObjEffect_SetRenderState(objjj, ADD);
		ObjEffect_SetLayer(objjj, 3);
		ObjEffect_SetPrimitiveType(objjj, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_CreateVertex(objjj, 4);
		ObjEffect_SetVertexUV(objjj, 0, 0, 0 + g);
		ObjEffect_SetVertexUV(objjj, 1, 63, 0 + g); 
		ObjEffect_SetVertexUV(objjj, 2, 63, 10 + g);
		ObjEffect_SetVertexUV(objjj, 3, 0, 10 + g);
		ObjEffect_SetVertexXY(objjj, 0, GetX, GetY);
		ObjEffect_SetVertexXY(objjj, 1, GetX, GetY); 
		ObjEffect_SetVertexXY(objjj, 2, GetX, GetY);
		ObjEffect_SetVertexXY(objjj, 3, GetX, GetY);
		ObjEffect_SetAngle(obj, 0, 0, angle);
		ObjEffect_SetLayer(objj, 4);
		ObjEffect_SetLayer(objj2, 4);
		while(!Obj_BeDeleted(obj)){
			Obj_SetSpeed(opt, Obj_GetSpeed(opt)+0.02);
			Obj_SetPosition(obj, Obj_GetX(opt), Obj_GetY(opt));
			counter++;
			if(ObjLaser_GetLength(obj)<400){
				ObjEffect_SetAngle(objj, 0, 0, rand_int(0, 360));
				ObjLaser_SetLength(obj, ObjLaser_GetLength(obj) + lol);
				Obj_SetPosition(objj2, ObjLaser_GetEndX(obj), Obj_GetY(obj));
				ObjEffect_SetAngle(objj2, 0, 0, angle + 90);
			}else if(!Obj_BeDeleted(objj)){
				Obj_Delete(objj);
			}
			Obj_SetPosition(objj, Obj_GetX(obj), Obj_GetY(obj));
			ObjEffect_SetScale(opt, 1 + 0.1*sin(aaaa), 1 + 0.1*sin(aaaa));
			ObjEffect_SetAngle(opt, 0, 0, aaaa);
			aaaa+=aaaa2;
			g+=16;
			ObjEffect_SetVertexXY(objjj, 3, Obj_GetX(obj) + (ObjLaser_GetWidth(obj)/2)*cos(angle - 90), Obj_GetY(obj) + (ObjLaser_GetWidth(obj)/2)*sin(angle - 90));
			ObjEffect_SetVertexXY(objjj, 0, ObjLaser_GetEndX(obj) + (ObjLaser_GetWidth(obj)/2)*cos(angle - 90), ObjLaser_GetEndY(obj) + (ObjLaser_GetWidth(obj)/2)*sin(angle - 90)); 
			ObjEffect_SetVertexXY(objjj, 1, ObjLaser_GetEndX(obj) + (ObjLaser_GetWidth(obj)/2)*cos(angle + 90), ObjLaser_GetEndY(obj) + (ObjLaser_GetWidth(obj)/2)*sin(angle + 90));
			ObjEffect_SetVertexXY(objjj, 2, Obj_GetX(obj) + (ObjLaser_GetWidth(obj)/2)*cos(angle + 90), Obj_GetY(obj) + (ObjLaser_GetWidth(obj)/2)*sin(angle + 90));
			ObjEffect_SetVertexUV(objjj, 0, 192, 0 + g);
			ObjEffect_SetVertexUV(objjj, 1, 255, 0 + g); 
			ObjEffect_SetVertexUV(objjj, 2, 255, 448 + g);
			ObjEffect_SetVertexUV(objjj, 3, 192, 448 + g);
			yield;
		}
				Obj_Delete(objj2);
				Obj_Delete(objjj);
				Obj_Delete(opt);
				Obj_Delete(objj);
	}	
	task OptionSecond(an, angle, lol, lol2, aaaa, aaaa2){
		let opt = Obj_Create(OBJ_EFFECT);
		Obj_SetPosition(opt, GetX, GetY);
		Obj_SetSpeed(opt, 6);
		Obj_SetAngle(opt, an);
		ObjEffect_SetTexture(opt, GetCurrentScriptDirectory~"circle.png");
		ObjEffect_SetRenderState(opt, ALPHA);
		ObjEffect_SetLayer(opt, 2);
		ObjEffect_SetPrimitiveType(opt, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_CreateVertex(opt, 4);
		ObjEffect_SetVertexUV(opt, 0, 0, 0);
		ObjEffect_SetVertexUV(opt, 1, 255, 0); 
		ObjEffect_SetVertexUV(opt, 2, 255, 255);
		ObjEffect_SetVertexUV(opt, 3, 0, 255);
		ObjEffect_SetVertexXY(opt, 0, -32, -32);
		ObjEffect_SetVertexXY(opt, 1, 32, -32); 
		ObjEffect_SetVertexXY(opt, 2, 32, 32);
		ObjEffect_SetVertexXY(opt, 3, -32, 32);
		loop(21){
			Obj_SetSpeed(opt, Obj_GetSpeed(opt)-0.02);
			Obj_SetAngle(opt, Obj_GetAngle(opt)-5);
			ObjEffect_SetScale(opt, 1 + 0.1*sin(aaaa), 1 + 0.1*sin(aaaa));
			ObjEffect_SetAngle(opt, 0, 0, aaaa);
			aaaa+=aaaa2;
			yield;
		}
		loop(lol2){yield;
			Obj_SetSpeed(opt, Obj_GetSpeed(opt)+0.02);
			ObjEffect_SetScale(opt, 1 + 0.1*sin(aaaa), 1 + 0.1*sin(aaaa));
			ObjEffect_SetAngle(opt, 0, 0, aaaa);
			aaaa+=aaaa2;}
		let g = 0;
		let counter = 0;
		let obj = Obj_Create(OBJ_LASER);
		Obj_SetPosition(obj, GetX, GetY);
		Obj_SetAngle(obj, angle);
		Obj_SetSpeed(obj, 0);
		ObjShot_SetGraphic(obj, 6);
		ObjLaser_SetSource(obj, false);
		ObjLaser_SetWidth(obj, 64);
		ObjLaser_SetLength(obj, 0);
		let objj = Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(objj, GetCurrentScriptDirectory~"light.png");
		ObjEffect_SetRenderState(objj, ADD);
		ObjEffect_SetPrimitiveType(objj, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_CreateVertex(objj, 4);
		ascent(i in 0..4){
			ObjEffect_SetVertexColor(objj, i, 255, 200, 25, 255);
		}
		ObjEffect_SetVertexUV(objj, 0, 0, 0);
		ObjEffect_SetVertexUV(objj, 1, 255, 0); 
		ObjEffect_SetVertexUV(objj, 2, 255, 255);
		ObjEffect_SetVertexUV(objj, 3, 0, 255);
		ObjEffect_SetVertexXY(objj, 0, -128, -128);
		ObjEffect_SetVertexXY(objj, 1, 128, -128); 
		ObjEffect_SetVertexXY(objj, 2, 128, 128);
		ObjEffect_SetVertexXY(objj, 3, -128, 128);
		let objj2 = Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(objj2, GetCurrentScriptDirectory~"LaserBlast.png");
		ObjEffect_SetRenderState(objj2, ADD);
		ObjEffect_SetPrimitiveType(objj2, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_CreateVertex(objj2, 4);
		ObjEffect_SetVertexUV(objj2, 0, 0, 0);
		ObjEffect_SetVertexUV(objj2, 1, 115, 0); 
		ObjEffect_SetVertexUV(objj2, 2, 115, 113);
		ObjEffect_SetVertexUV(objj2, 3, 0, 113);
		ObjEffect_SetVertexXY(objj2, 0, -48, -48);
		ObjEffect_SetVertexXY(objj2, 1, 48, -48); 
		ObjEffect_SetVertexXY(objj2, 2, 48, 48);
		ObjEffect_SetVertexXY(objj2, 3, -48, 48);
		ObjEffect_SetAngle(objj2, 0, 0, angle + 90);
		let objjj = Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(objjj, GetCurrentScriptDirectory~"LAZERBEAM3.png");
		ObjEffect_SetRenderState(objjj, ADD);
		ObjEffect_SetLayer(objjj, 3);
		ObjEffect_SetPrimitiveType(objjj, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_CreateVertex(objjj, 4);
		ObjEffect_SetVertexUV(objjj, 0, 0, 0 + g);
		ObjEffect_SetVertexUV(objjj, 1, 63, 0 + g); 
		ObjEffect_SetVertexUV(objjj, 2, 63, 10 + g);
		ObjEffect_SetVertexUV(objjj, 3, 0, 10 + g);
		ObjEffect_SetVertexXY(objjj, 0, GetX, GetY);
		ObjEffect_SetVertexXY(objjj, 1, GetX, GetY); 
		ObjEffect_SetVertexXY(objjj, 2, GetX, GetY);
		ObjEffect_SetVertexXY(objjj, 3, GetX, GetY);
		ObjEffect_SetAngle(obj, 0, 0, angle);
		ObjEffect_SetLayer(objj, 4);
		ObjEffect_SetLayer(objj2, 4);
		while(!Obj_BeDeleted(obj)){
			Obj_SetSpeed(opt, Obj_GetSpeed(opt)+0.02);
			Obj_SetPosition(obj, Obj_GetX(opt), Obj_GetY(opt));
			counter++;
			if(ObjLaser_GetLength(obj)<400){
				ObjEffect_SetAngle(objj, 0, 0, rand_int(0, 360));
				ObjLaser_SetLength(obj, ObjLaser_GetLength(obj) + lol);
				Obj_SetPosition(objj2, ObjLaser_GetEndX(obj), Obj_GetY(obj));
				ObjEffect_SetAngle(objj2, 0, 0, angle + 90);
			}else if(!Obj_BeDeleted(objj)){
				Obj_Delete(objj);
			}
			Obj_SetPosition(objj, Obj_GetX(obj), Obj_GetY(obj));
			ObjEffect_SetScale(opt, 1 + 0.1*sin(aaaa), 1 + 0.1*sin(aaaa));
			ObjEffect_SetAngle(opt, 0, 0, aaaa);
			aaaa+=aaaa2;
			g+=16;
			ObjEffect_SetVertexXY(objjj, 3, Obj_GetX(obj) + (ObjLaser_GetWidth(obj)/2)*cos(angle - 90), Obj_GetY(obj) + (ObjLaser_GetWidth(obj)/2)*sin(angle - 90));
			ObjEffect_SetVertexXY(objjj, 0, ObjLaser_GetEndX(obj) + (ObjLaser_GetWidth(obj)/2)*cos(angle - 90), ObjLaser_GetEndY(obj) + (ObjLaser_GetWidth(obj)/2)*sin(angle - 90)); 
			ObjEffect_SetVertexXY(objjj, 1, ObjLaser_GetEndX(obj) + (ObjLaser_GetWidth(obj)/2)*cos(angle + 90), ObjLaser_GetEndY(obj) + (ObjLaser_GetWidth(obj)/2)*sin(angle + 90));
			ObjEffect_SetVertexXY(objjj, 2, Obj_GetX(obj) + (ObjLaser_GetWidth(obj)/2)*cos(angle + 90), Obj_GetY(obj) + (ObjLaser_GetWidth(obj)/2)*sin(angle + 90));
			ObjEffect_SetVertexUV(objjj, 0, 192, 0 + g);
			ObjEffect_SetVertexUV(objjj, 1, 255, 0 + g); 
			ObjEffect_SetVertexUV(objjj, 2, 255, 448 + g);
			ObjEffect_SetVertexUV(objjj, 3, 192, 448 + g);
			yield;
		}
				Obj_Delete(objj2);
				Obj_Delete(objjj);
				Obj_Delete(opt);
				Obj_Delete(objj);
	}
	
	
	task OptionMain(angle2, hhh){
		let g = 0;
		let counter = 0;
		let counter2 = 0;
		let number = 0;
		let angle = 0;
		let obj = Obj_Create(OBJ_LASER);
		Obj_SetPosition(obj, GetX + 80*cos(angle2), GetY + 80*sin(angle2));
		Obj_SetSpeed(obj, 0);
		ObjShot_SetGraphic(obj, 6);
		ObjLaser_SetSource(obj, false);
		ObjLaser_SetWidth(obj, 64);
		ObjLaser_SetLength(obj, 0);
		let objj = Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(objj, GetCurrentScriptDirectory~"light.png");
		ObjEffect_SetRenderState(objj, ADD);
		ObjEffect_SetPrimitiveType(objj, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_CreateVertex(objj, 4);
		ascent(i in 0..4){
			ObjEffect_SetVertexColor(objj, i, 255, 255, 255, 0);
		}
		ObjEffect_SetVertexUV(objj, 0, 0, 0);
		ObjEffect_SetVertexUV(objj, 1, 255, 0); 
		ObjEffect_SetVertexUV(objj, 2, 255, 255);
		ObjEffect_SetVertexUV(objj, 3, 0, 255);
		ObjEffect_SetVertexXY(objj, 0, -128, -128);
		ObjEffect_SetVertexXY(objj, 1, 128, -128); 
		ObjEffect_SetVertexXY(objj, 2, 128, 128);
		ObjEffect_SetVertexXY(objj, 3, -128, 128);
		let objj2 = Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(objj2, GetCurrentScriptDirectory~"light.png");
		ObjEffect_SetRenderState(objj2, ADD);
		ObjEffect_SetPrimitiveType(objj2, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_CreateVertex(objj2, 4);
		ObjEffect_SetVertexUV(objj2, 0, 0, 0);
		ObjEffect_SetVertexUV(objj2, 1, 255, 0); 
		ObjEffect_SetVertexUV(objj2, 2, 255, 255);
		ObjEffect_SetVertexUV(objj2, 3, 0, 255);
		ObjEffect_SetVertexXY(objj2, 0, -48, -48);
		ObjEffect_SetVertexXY(objj2, 1, 48, -48); 
		ObjEffect_SetVertexXY(objj2, 2, 48, 48);
		ObjEffect_SetVertexXY(objj2, 3, -48, 48);
		ascent(i in 0..4){
			ObjEffect_SetVertexColor(objj2, i, 255, 255, 255, 0);
		}
		let objjj = Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(objjj, GetCurrentScriptDirectory~"LAZERBEAM2.png");
		ObjEffect_SetRenderState(objjj, ADD);
		ObjEffect_SetLayer(objjj, 3);
		ObjEffect_SetPrimitiveType(objjj, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_CreateVertex(objjj, 4);
		ObjEffect_SetVertexUV(objjj, 0, 0, 0 + g);
		ObjEffect_SetVertexUV(objjj, 1, 63, 0 + g); 
		ObjEffect_SetVertexUV(objjj, 2, 63, 10 + g);
		ObjEffect_SetVertexUV(objjj, 3, 0, 10 + g);
		ObjEffect_SetVertexXY(objjj, 0, GetX, GetY);
		ObjEffect_SetVertexXY(objjj, 1, GetX, GetY); 
		ObjEffect_SetVertexXY(objjj, 2, GetX, GetY);
		ObjEffect_SetVertexXY(objjj, 3, GetX, GetY);
		ObjEffect_SetLayer(objj, 4);
		ObjEffect_SetLayer(objj2, 4);
		let ggg = 90;
		while(!Obj_BeDeleted(obj)){
			if(counter>hhh){
				if(number<40){
					number+=0.25;
				}
				counter2++;
			}
			angle = angle2 + number*sin(counter2/1.6);
			Obj_SetAngle(obj, angle);
			Obj_SetPosition(obj, GetX + 80*cos(angle), GetY + 80*sin(angle));
			counter++;
			if(ObjLaser_GetLength(obj)<600){
				ObjEffect_SetAngle(objj, 0, 0, rand_int(0, 360));
				ObjLaser_SetLength(obj, ObjLaser_GetLength(obj) + 10);
				Obj_SetPosition(objj2, ObjLaser_GetEndX(obj), Obj_GetY(obj));
				ObjEffect_SetAngle(objj2, 0, 0, rand(0, 360));
			}else if(!Obj_BeDeleted(objj2)){
				Obj_Delete(objj2);
			}
			ggg++;
			Obj_SetPosition(objj, Obj_GetX(obj), Obj_GetY(obj));
			g+=16;
			ObjEffect_SetVertexXY(objjj, 3, Obj_GetX(obj) + (ObjLaser_GetWidth(obj)/2)*cos(angle - 90), Obj_GetY(obj) + (ObjLaser_GetWidth(obj)/2)*sin(angle - 90));
			ObjEffect_SetVertexXY(objjj, 0, ObjLaser_GetEndX(obj) + (ObjLaser_GetWidth(obj)/2)*cos(angle - 90), ObjLaser_GetEndY(obj) + (ObjLaser_GetWidth(obj)/2)*sin(angle - 90)); 
			ObjEffect_SetVertexXY(objjj, 1, ObjLaser_GetEndX(obj) + (ObjLaser_GetWidth(obj)/2)*cos(angle + 90), ObjLaser_GetEndY(obj) + (ObjLaser_GetWidth(obj)/2)*sin(angle + 90));
			ObjEffect_SetVertexXY(objjj, 2, Obj_GetX(obj) + (ObjLaser_GetWidth(obj)/2)*cos(angle + 90), Obj_GetY(obj) + (ObjLaser_GetWidth(obj)/2)*sin(angle + 90));
			ObjEffect_SetVertexUV(objjj, 0, 192, 0 + g);
			ObjEffect_SetVertexUV(objjj, 1, 255, 0 + g); 
			ObjEffect_SetVertexUV(objjj, 2, 255, 448 + g);
			ObjEffect_SetVertexUV(objjj, 3, 192, 448 + g);
			yield;
		}
	}
	@BackGround{
		if(GetCommonData("HB")>400 && gy<255){
			gy+=7.5;
		}
		SetAlpha(gy);
		SetTexture(GetCurrentScriptDirectory~"bg.png");
		SetGraphicRect(0 + all, 0 + all, 1024 + all, 1024 + all);
		SetGraphicAngle(0, 0, all/4);
		DrawGraphic(224, 240);
		SetAlpha(255);
	}
}