Background Tiled

G

gamedev513

Guest
Hey guys,

Im trying to hard-code my background layer for my main menu instead of setting it up in the room editor. I am using the code below, however, it only draws a single background sprite in the top left corner of the window vs. tiling horizontally and vertically. Any suggestions on how to make it run across the entire screen both x and y??

Code:
var bg_layer = layer_create(100, "Menu_Background");
var bg = layer_background_create(bg_layer, spr_menu_bg1);

layer_background_index(spr_menu_bg1, 0);

layer_background_vtiled(spr_menu_bg1, true);
layer_background_htiled(spr_menu_bg1, true);

layer_background_alpha(spr_menu_bg1, 1);
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
layer_background_ property setter functions take the background ID that layer_background_create returns, not the background index used for the layer. So you should be using "bg" instead of "spr_menu_bg1" for them.
 
Top