
let layer = 1;
let bairitu = 1;

task Tgazou(x1,y1,x2,y2)
{
	let system = GetCurrentScriptDirectory~"img\system.png";
	let objenemy = Obj_Create(OBJ_EFFECT);//エフェクトオブジェクトを作成
	ObjEffect_SetTexture(objenemy, imgEnemy);//なんらかのテクスチャを設定
	ObjEffect_SetPrimitiveType(objenemy, PRIMITIVE_TRIANGLESTRIP);//プリミティブタイプを設定
	ObjEffect_CreateVertex(objenemy, 4);//頂点を4個つくる
	ObjEffect_SetLayer(objenemy,layer);
	
	//四角形状に各頂点の座標を設定
	ObjEffect_SetVertexXY(objenemy, 0, -(x2-x1)*bairitu/2, -(y2-y1)*bairitu/2);
	ObjEffect_SetVertexXY(objenemy, 1, -(x2-x1)*bairitu/2,  (y2-y1)*bairitu/2);
	ObjEffect_SetVertexXY(objenemy, 2,  (x2-x1)*bairitu/2, -(y2-y1)*bairitu/2);
	ObjEffect_SetVertexXY(objenemy, 3,  (x2-x1)*bairitu/2,  (y2-y1)*bairitu/2);
	
	//四角形状に各頂点のUV値を設定。(0,0)-(10,10)の部分。
	ObjEffect_SetVertexUV(objenemy, 0, x1, y1);
	ObjEffect_SetVertexUV(objenemy, 1, x1, y2);
	ObjEffect_SetVertexUV(objenemy, 2, x2, y1);
	ObjEffect_SetVertexUV(objenemy, 3, x2, y2);

	Obj_SetPosition(objenemy, GetX, GetY);

	
	loop{
		ObjEffect_SetLayer(objenemy,layer);
		ObjEffect_SetVertexXY(objenemy, 0, -(x2-x1)*bairitu/2, -(y2-y1)*bairitu/2);
		ObjEffect_SetVertexXY(objenemy, 1, -(x2-x1)*bairitu/2,  (y2-y1)*bairitu/2);
		ObjEffect_SetVertexXY(objenemy, 2,  (x2-x1)*bairitu/2, -(y2-y1)*bairitu/2);
		ObjEffect_SetVertexXY(objenemy, 3,  (x2-x1)*bairitu/2,  (y2-y1)*bairitu/2);
		Obj_SetX(objenemy,GetX);
		Obj_SetY(objenemy,GetY);
		yield;
	}
	Obj_Delete(objenemy);
}


task Tgazou2(x1,y1,x2,y2)
{
	let system = GetCurrentScriptDirectory~"img\system.png";
	let objenemy = Obj_Create(OBJ_EFFECT);//エフェクトオブジェクトを作成
	ObjEffect_SetTexture(objenemy, imgEnemy);//なんらかのテクスチャを設定
	ObjEffect_SetPrimitiveType(objenemy, PRIMITIVE_TRIANGLESTRIP);//プリミティブタイプを設定
	ObjEffect_CreateVertex(objenemy, 4);//頂点を4個つくる
	ObjEffect_SetLayer(objenemy,layer);
	
	//四角形状に各頂点の座標を設定
	ObjEffect_SetVertexXY(objenemy, 0, -(x2-x1)*bairitu/2, -(y2-y1)*bairitu/2);
	ObjEffect_SetVertexXY(objenemy, 1, -(x2-x1)*bairitu/2,  (y2-y1)*bairitu/2);
	ObjEffect_SetVertexXY(objenemy, 2,  (x2-x1)*bairitu/2, -(y2-y1)*bairitu/2);
	ObjEffect_SetVertexXY(objenemy, 3,  (x2-x1)*bairitu/2,  (y2-y1)*bairitu/2);
	
	//四角形状に各頂点のUV値を設定。(0,0)-(10,10)の部分。
	ObjEffect_SetVertexUV(objenemy, 0, x1, y1);
	ObjEffect_SetVertexUV(objenemy, 1, x1, y2);
	ObjEffect_SetVertexUV(objenemy, 2, x2, y1);
	ObjEffect_SetVertexUV(objenemy, 3, x2, y2);

	Obj_SetPosition(objenemy, GetX, GetY);

	
	loop{
		ObjEffect_SetLayer(objenemy,layer);
		ObjEffect_SetVertexXY(objenemy, 0, -(x2-x1)*bairitu/2, -(y2-y1)*bairitu/2);
		ObjEffect_SetVertexXY(objenemy, 1, -(x2-x1)*bairitu/2,  (y2-y1)*bairitu/2);
		ObjEffect_SetVertexXY(objenemy, 2,  (x2-x1)*bairitu/2, -(y2-y1)*bairitu/2);
		ObjEffect_SetVertexXY(objenemy, 3,  (x2-x1)*bairitu/2,  (y2-y1)*bairitu/2);
		ObjEffect_SetAngle(objenemy,0,0,angle);
		Obj_SetX(objenemy,GetX);
		Obj_SetY(objenemy,GetY);
		yield;
	}
	Obj_Delete(objenemy);
}

task Tgazou3(x1,y1,x2,y2,way)
{
	let system = GetCurrentScriptDirectory~"img\system.png";
	let objenemy = Obj_Create(OBJ_EFFECT);//エフェクトオブジェクトを作成
	ObjEffect_SetTexture(objenemy, imgEnemy);//なんらかのテクスチャを設定
	ObjEffect_SetPrimitiveType(objenemy, PRIMITIVE_TRIANGLESTRIP);//プリミティブタイプを設定
	ObjEffect_CreateVertex(objenemy, 4);//頂点を4個つくる
	ObjEffect_SetLayer(objenemy,layer);
	
	//四角形状に各頂点の座標を設定
	ObjEffect_SetVertexXY(objenemy, 0, -(x2-x1)*bairitu/2, -(y2-y1)*bairitu/2);
	ObjEffect_SetVertexXY(objenemy, 1, -(x2-x1)*bairitu/2,  (y2-y1)*bairitu/2);
	ObjEffect_SetVertexXY(objenemy, 2,  (x2-x1)*bairitu/2, -(y2-y1)*bairitu/2);
	ObjEffect_SetVertexXY(objenemy, 3,  (x2-x1)*bairitu/2,  (y2-y1)*bairitu/2);
	
	//四角形状に各頂点のUV値を設定。(0,0)-(10,10)の部分。
	ObjEffect_SetVertexUV(objenemy, 0, x1, y1);
	ObjEffect_SetVertexUV(objenemy, 1, x1, y2);
	ObjEffect_SetVertexUV(objenemy, 2, x2, y1);
	ObjEffect_SetVertexUV(objenemy, 3, x2, y2);

	Obj_SetPosition(objenemy, GetX, GetY);

	
	loop{
		ObjEffect_SetLayer(objenemy,layer);
		ObjEffect_SetVertexXY(objenemy, 0, -(x2-x1)*bairitu/2, -(y2-y1)*bairitu/2);
		ObjEffect_SetVertexXY(objenemy, 1, -(x2-x1)*bairitu/2,  (y2-y1)*bairitu/2);
		ObjEffect_SetVertexXY(objenemy, 2,  (x2-x1)*bairitu/2, -(y2-y1)*bairitu/2);
		ObjEffect_SetVertexXY(objenemy, 3,  (x2-x1)*bairitu/2,  (y2-y1)*bairitu/2);
		ObjEffect_SetAngle(objenemy,0,0,genteikaku(GetAngleToPlayer(),way));
		Obj_SetX(objenemy,GetX);
		Obj_SetY(objenemy,GetY);
		yield;
	}
	Obj_Delete(objenemy);
}