How do I check if a tilemap is overlapping something?

0 favourites
  • 3 posts
From the Asset Store
Enchanted Forest & Cave 16x16 Tilemap with Environment Sprites
  • on created, i need a tilemap overlapping another one to make it a child,

    i need to know where this collection of blocks is. if there is another way, i welcome it.

    buuut, id done with rooms after this! ..well... the location and size.. ill need to make them work next ,:D

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Tilemap object doesn't have a check for overlap, so you'll have to work around that. It depends a little on what you are looking for. You can try "for each tile -> pick overlapping point" Or if you compare with another tilemap, compare the tiles.

    But can I suggest something because I've seen you work on this project for a while. I think all of this should be driven by arrays instead of tilemaps. No doubt this is a great learning experience either way, but I've been in a very similar position before where I was kinda checking for overlaps etc. which was honestly a bit of a nightmare not only to code in the first place, but also to maintain. In the end it SOMEHOW worked (I have no idea how even lmao) but realistically arrays will be your savior. I wouldn't necessarily suggest reworking everything now but keep it in mind for maybe the next project :)

  • WackyToaster

    yes! that was my original angle, rojo advised me against arrays as a tile map is basically an array

    to his defense, i got it done with his advice. i could easily add an array for the floor map.

    so, im thinking: array checks main floor tilemap for a room tile.

    for each room tilemap add a z axis to the array.

    set its starting point in the array check to tilemap x,y /96(tilesize)

    then for each xy, compare to z in the array to find overlapping points...

    then i could set them to the same family.

    something along those lines.

    thanks for the advice, see how it goes ive been writing this for an hour and im already lost, but i have a guess now.

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