diff --git a/Manual/contents/Additional_Information/Guide_To_Using_JSON.htm b/Manual/contents/Additional_Information/Guide_To_Using_JSON.htm index c76b01134..1f60bfe0a 100644 --- a/Manual/contents/Additional_Information/Guide_To_Using_JSON.htm +++ b/Manual/contents/Additional_Information/Guide_To_Using_JSON.htm @@ -93,7 +93,7 @@
The latter method (of specifying the filter/effect in your code) only works with string literals directly specified in the function argument, which means that if you use a variable or any logic to come up with the filter/effect name string, then the asset compiler will not detect that and the filter/effect will not be loaded.
Consider the following examples:
-// This will work on its own
- var _fxshake = fx_create("_filter_screenshake");
-
- // This will NOT work on its own
- var _myfilters = { screenshake: "_screenshake" }
- var _filter_to_use = "_filter" + _myfilters.screenshake;
+
// This will work on its own
+ var _fxshake = fx_create("_filter_screenshake");
+
+ // This will NOT work on its own
+ var _myfilters = { screenshake: "_screenshake" }
+ var _filter_to_use = "_filter" + _myfilters.screenshake;
var _fxshake = fx_create(_filter_to_use);
To ensure that the latter method works, you can simply add the filter to at least one room in your project, or ensure that fx_create() is called anywhere in your project with the filter name as a string constant (and not a variable).
@@ -73,17 +72,17 @@Here is example code for the workflow mentioned above:
Create Event
-// Store the FX struct, and its parameters struct, in variables
- pixelate_fx = layer_get_fx("Effect_1");
+
// Store the FX struct, and its parameters struct, in variables
+ pixelate_fx = layer_get_fx("Effect_1");
pixelate_fx_params = fx_get_parameters(pixelate_fx);
Step Event
-// Change param as variable
- pixelate_fx_params.g_CellSize = round((mouse_x / room_width) * 64);
-
- // Or, change param as string
- pixelate_fx_params[$ "g_CellSize"] = round((mouse_x / room_width) * 64);
-
- // Apply updated parameters struct to the FX struct
+
// Change param as variable
+ pixelate_fx_params.g_CellSize = round((mouse_x / room_width) * 64);
+
+ // Or, change param as string
+ pixelate_fx_params[$ "g_CellSize"] = round((mouse_x / room_width) * 64);
+
+ // Apply updated parameters struct to the FX struct
fx_set_parameters(pixelate_fx, pixelate_fx_params);
By default, a filter/effect is applied to the layer that it is assigned to and all layers below that layer, however you can use fx_set_single_layer() to enable Single Layer mode for a filter/effect to make sure that it's only applied to the layer that it is assigned to.
The following visual shows a filter being applied to multiple layers (which is the default behaviour for all FX layers), and then the same filter with Single Layer mode enabled and applied to a non-FX layer:
+
+