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

GM:S 1.4 Does tile_add() replace tiles?

Discussion in 'Programming' started by ookki, Mar 14, 2019.

  1. ookki

    ookki Member

    Joined:
    Aug 19, 2016
    Posts:
    12
    Asked this on discord but they weren't sure. If you place a tile on another tile with same coordinates and layer with tile_add(), does it replace the old tile? I really hope it does, so I don't have to worry about duplicates.
     
  2. TheSly

    TheSly Member

    Joined:
    Jan 16, 2017
    Posts:
    1,001
    Since a tile layer can only have one tile at each gridded tile location per layer, if you use tile_add() to put a different tile onto an existing one, then it will replace it. If it didn't, all other functions related to accessing that tile position would be useless.
     
  3. ookki

    ookki Member

    Joined:
    Aug 19, 2016
    Posts:
    12
    Glorious! I had a feeling it might be this way, but I just wanted to be sure. Thanks!
     
  4. YellowAfterlife

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

    Joined:
    Apr 21, 2016
    Posts:
    2,445
    Note that GMS1.4 tile_add does not replace tiles because tiles are merely portions of backgrounds placed around the room. There's tile_layer_find to locate the original tile at coordinates.
     
  5. TheSly

    TheSly Member

    Joined:
    Jan 16, 2017
    Posts:
    1,001
    I didn't notice he had flagged 1.4, I was referring to GMS2. Considering it is not even supported anymore, it still surprises me people are using it.
     
  6. TheouAegis

    TheouAegis Member

    Joined:
    Jul 3, 2016
    Posts:
    7,143
    Because GMS 1.4.8 is cheaper for some of us and has better backwards compatibility with old projects. lol
     
  7. ookki

    ookki Member

    Joined:
    Aug 19, 2016
    Posts:
    12
    So if first make a wall with all tiles facing left and then add corner tiles on the topmost and bottom most tiles, I have two tiles being drawn on each other?
     
  8. YellowAfterlife

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

    Joined:
    Apr 21, 2016
    Posts:
    2,445
    Yes - you can verify this by replacing your tileset image with a semi-transparent one (so that it's apparent when tiles overlap)
     

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