1. Hello Guest! It's with a heavy heart that we must announce the removal of the Legacy GMC Archive. If you wish to save anything from it, now's the time! Please see this topic for more information.
    Dismiss Notice

Background Tiled

Discussion in 'Programming' started by gamedev513, Sep 2, 2017.

  1. gamedev513

    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??

    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);
  2. YellowAfterlife

    YellowAfterlife ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ Forum Staff Moderator

    Apr 21, 2016
    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.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice