How do I detect overlapping of a tilemap?

0 favourites
  • 4 posts
From the Asset Store
This is a black tileset with 2 tilemaps, props, one animated character and more.
  • I am creating a procedurally generated world map using tilemaps. Essentially, each tile in a tilemap is 16x16 pixels, and the game creates a "chunk" or a tilemap object with a size of 256x256 pixels, or 16 horizontal tiles and 16 vertical ones. Essentially the game will create a new "chunk" object within a certain distance of the player. My issue is, I use these simple sprites that are created every time a new chunk is created, to check if there is space to make another chunk, but, if one of these sprites overlaps an already existing chunk, I want it to be destroyed, so that it doesn't make a new chunk on top of the old one. The problem is if I use the "is overlapping (chunk)" block, nothing happens, no overlap is detected, and the sprite object isn't deleted, instead, a game-breaking amount of tilemaps are created on top of each other. Here's my file...

    dropbox.com/s/n7vo6xmaf2n25ws/File.c3p

  • Collisions on a tilemap happen on a per tile basis. So if your sprite is overlapping an empty space in the tilemap then nothing will happen. Make sure your sprite overlaps an actual tile, and not only that, but within the tiles collision polygon (since you can edit a tile's collision polygon).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I am confident that the sprite is actually overlapping the tilemap, I don't think this is the issue...

  • You disabled collisions for "dirt" tiles 0 and 1. So when a dirt chunk is created, it essentially has no collision polygon, that's why your overlapping checks don't work, and all dirt chunks get covered with rock chunks. But what's worse is that your rock chunks have very few rocks (the only tile that has collisions), so they in turn also get covered by many more chunks...

    If you just want to fill the area with tilemaps, what you are doing is a weird and extremely ineffective method. All you need is one loop:

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