/**
 * 使い魔の回転
 * 
 * @param {Integer} speed 回転角度
 */
task Rotate( speed ){
	let angle = 0;
	
	loop{
		angle += speed;
		SetGraphicAngle( 0, 0, angle );
		yield;
	}
}

/**
 * 使い魔のエネミーマーカーを表示する
 */
task EnemyMarker(){
	let alpha = 0;
	
	let obj = Obj_Create( OBJ_EFFECT );
	ObjEffect_SetTexture( obj, "img\System.png" );
	ObjEffect_SetPrimitiveType( obj, PRIMITIVE_TRIANGLESTRIP );
	ObjEffect_CreateVertex( obj, 4 );
	
	ObjEffect_SetVertexXY( obj, 0, -22, -8 );
	ObjEffect_SetVertexXY( obj, 1, -22,  8 );
	ObjEffect_SetVertexXY( obj, 2,  22, -8 );
	ObjEffect_SetVertexXY( obj, 3,  22,  8 );
	
	ObjEffect_SetVertexUV( obj, 0,  0, 160 );
	ObjEffect_SetVertexUV( obj, 1,  0, 176 );
	ObjEffect_SetVertexUV( obj, 2, 44, 160 );
	ObjEffect_SetVertexUV( obj, 3, 44, 176 );
	
	ObjEffect_SetVertexColor( obj, 0, 232, 255, 255, 255 );
	ObjEffect_SetVertexColor( obj, 1, 232, 255, 255, 255 );
	ObjEffect_SetVertexColor( obj, 2, 232, 255, 255, 255 );
	ObjEffect_SetVertexColor( obj, 3, 232, 255, 255, 255 );
	
	ObjEffect_SetLayer( obj, 8 );
	
	Obj_SetPosition( obj, GetX(), GetClipMaxY() + 10 );
	
	while( !Obj_BeDeleted(obj) ){
		Obj_SetPosition( obj, GetX(), GetClipMaxY() + 10 );
		
		alpha = absolute( GetX() - GetPlayerX() ) * ( 232 - 164 ) / 90;
		
		alpha += 164;
		
		if( alpha > 232 ){
			alpha = 232;
		}
		
		if( GetX() < GetClipMinX() - 44 || GetX() > GetClipMaxX() + 22 ){
			alpha = 0;
		}
		
		ObjEffect_SetVertexColor( obj, 0, alpha, 255, 255, 255 );
		ObjEffect_SetVertexColor( obj, 1, alpha, 255, 255, 255 );
		ObjEffect_SetVertexColor( obj, 2, alpha, 255, 255, 255 );
		ObjEffect_SetVertexColor( obj, 3, alpha, 255, 255, 255 );
		
		yield;
	}
}