GML How to destroy tiles?

Discussion in 'Programming' started by Capptianm, Jun 12, 2019.

  1. Capptianm

    Capptianm Member

    Joined:
    Jul 15, 2017
    Posts:
    74
    In my game, I have an item that creates a platformer under a player. I've decided to create an object that creates and destroys tiles. I have the creation of tiles done with this piece of code in the create event:

    Code:
    var i = layer_get_id("collision")
    tilemap = layer_tilemap_get_id(i)
    tile = tilemap_get_at_pixel(tilemap, 1, 1)
    
    tilemap_set_at_pixel(tilemap, tile, x, y)
    tilemap_set_at_pixel(tilemap, tile, x + 32, y)
    tilemap_set_at_pixel(tilemap, tile, x - 32, y)
    I want to destroy the tiles in the destroy event, but I'm not sure how to destroy the tiles, how would I do that?
     
  2. TheSly

    TheSly Member

    Joined:
    Jan 16, 2017
    Posts:
    947
    You just set the tile you want to destroy to a value of 0, using any method, e.g. tilemap_set() or tilemap_set_at_pixel()
     

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