Using this function you can change whether the given background element on a layer should be tiled horizontally or not. You give the background element ID (which you get when you create a background element using layer_background_create() or when you use the function layer_background_get_id()), and then set the tiling value. If set to true then the element will be displayed tiled horizontally across the room, and when set to false, the element will not be tiled.


layer_background_htiled(background_element_id, tiled);


参数 描述
background_element_id The unique ID value of the background element to change
visible The horizontal tiling toggle, which can be true or false




var back = layer_background_get_id(layer);
if !layer_background_get_htiled(back) || !layer_background_get_vtiled(back)
   layer_background_htiled(back, true);
   layer_background_vtiled(back, true);

The above code will check the background element assigned to the layer the instance running the code is on and if it is not tiled in either direction it will set it to tile vertically and horizontally.

上一页: Background Layer Functions
next: layer_background_vtiled
© Copyright YoYo Games Ltd. 2018 All Rights Reserved