//魔法陣

let imgBIGCIRCLE = GetCurrentScriptDirectory~"img\Circle_Hex.png";

LoadGraphic(imgBIGCIRCLE);

sub boss_magic_circle
{
	effect_circle(imgBIGCIRCLE, 255, 0, 0, 255); //青魔法陣発生
}

task effect_circle(graphic, c_alpha, c_red, c_green, c_blue)
{
	//初期設定
	let obj = Obj_Create(OBJ_EFFECT);
	ObjEffect_SetTexture(obj, graphic);
	ObjEffect_SetRenderState(obj, ADD);
	ObjEffect_SetLayer(obj, 2);
	ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
	ObjEffect_CreateVertex(obj, 4);
	ObjEffect_SetVertexUV(obj, 0,   0,   0);
	ObjEffect_SetVertexUV(obj, 1, 256,   0);
	ObjEffect_SetVertexUV(obj, 2, 256, 256);
	ObjEffect_SetVertexUV(obj, 3,   0, 256);
	ObjEffect_SetVertexXY(obj, 0,-75,-75);
	ObjEffect_SetVertexXY(obj, 1, 75,-75);
	ObjEffect_SetVertexXY(obj, 2, 75, 75);
	ObjEffect_SetVertexXY(obj, 3,-75, 75);
	ascent (let n in 0 .. 4)
	{
		ObjEffect_SetVertexColor(obj, n, c_alpha, c_red, c_green, c_blue);
	}

	
	//ずっとループのターン
	let t = 0;
	let angle = 0; let scale = 0;
	
	loop(20)
	{
		scale += 0.05;
		ObjEffect_SetScale(obj, scale, scale);
		Obj_SetPosition(obj, GetX, GetY);
		
		yield;
	}
	loop
	{
		ObjEffect_SetScale(obj, scale, scale);
		ObjEffect_SetAngle(obj, 0, 0, angle);
		Obj_SetPosition(obj, GetX, GetY);
		
		scale += sin(t)/60;
		angle -= 5;
		
		t+=3; angle %= 360;
		yield;
	}
	Obj_Delete(obj);
}

function wait(w) {
 loop(w) { yield; }
}

task Snowshot(x, y, angle, type, type2, delay) {
 let obj1 = Obj_Create(OBJ_SHOT);
 let i = 0;
 Obj_SetX(obj1, x);
 Obj_SetY(obj1, y);
 Obj_SetSpeed(obj1, 0);
 Obj_SetAngle(obj1, angle);
 ObjShot_SetDelay(obj1, delay);
 ObjShot_SetGraphic(obj1, type);
 if(x < GetPlayerX + 60 && x > GetPlayerX - 60 && y < GetPlayerY + 60 && y > GetPlayerY - 60) {
  Obj_Delete(obj1);
 }
 wait(180);
 PlaySE(suzuSE);
 Obj_SetAngle(obj1, angle);
 ObjShot_SetGraphic(obj1, type2);
 loop{
  Obj_SetSpeed(obj1, 0+i);
  i += 0.0025;
  wait(1);
 }
}

#include_function ".\変数集.txt"