Erase all tiles from tile, except for tiles specified?

0 favourites
  • 9 posts
From the Asset Store
slide the tiles to fill the board.60 awesome levels.
  • Is there a way of clearing ALL of the tiles from a tilemap, except for specific tiles listed in a variable? I'm using R0J0hound 's example: https://dl.dropboxusercontent.com/u/542 ... lemap.capx but in my situation, it would be much more efficient to clear all of the tiles, besides the few I need, rather than clear a selected few. I thought I'd start a new thread as the last tilemap thread got a bit away from the original point.

  • Changed the title to be more descriptive.

  • You should be able to do it by changing the logic around. In it able to open the capx right now so this may be a bit different. You don't even need a variable. You could take a loop over all the tiles and make these sub-events to keep for example tiles 4 and 6.

    Tile=4

    Else

    Tile=6

    Else

    --- erase

    Or if you still wish to use a variable just structure the text variable used for the list like this. Comma seperated and starting and ending with a comma.

    Global text keep=",4,6,"

    Then use a sub-event like this:

    System compare: find(keep, ","&tile&",") = -1

    --- erase

  • You should be able to do it by changing the logic around. In it able to open the capx right now so this may be a bit different. You don't even need a variable. You could take a loop over all the tiles and make these sub-events to keep for example tiles 4 and 6.

    Tile=4

    Else

    Tile=6

    Else

    --- erase

    Or if you still wish to use a variable just structure the text variable used for the list like this. Comma seperated and starting and ending with a comma.

    Global text keep=",4,6,"

    Then use a sub-event like this:

    System compare: find(keep, ","&tile&",") = -1

    --- erase

    Thanks! Here's a screencap of what I have so far, it WORKS, it's just going to be inefficient when I fill up those tiles:

    I'll try and use your suggestion, I'm not sure if the screengrab is of any use to you. I have three tilemaps, one for display, one for solids and one for jump-thrus.

  • R0J0hound trying to work out what &tile& should be?

  • Replace tile with the expression to get a tile at a location.

  • EDIT: This works!

    Thank you R0J0hound! Hopefully that looks okay?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • TileAt(loopindex("x"),loopindex("y"))

  • TileAt(loopindex("x"),loopindex("y"))

    Sorry, got it myself in the end!

Jump to:
Active Users
There are 2 visitors browsing this topic (0 users and 2 guests)