Question about Tilemap object

0 favourites
  • 9 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • Hi,

    I'm developing this dungeon-mining game with randomly-generated levels - capx below. Arrow keys to move, WASD to mine.

    I've been reading up about the new Tilemap object, which sounds like it's perfect for this project - I'm currently generating upwards of 7,500 tile sprites individually, so am I right in thinking using Tilemap would make this a lot more efficient and framerate-friendly?

    As you can see from the capx, there's a fairly lengthy map generation process before the game actually begins - would I still be able to transpose all those events to the Tilemap object if I used it? I don't mind doing that at all if it would make everything more efficient, but I wanted to ask before I start doing that - is it right for a project like this that has random levels?

    If someone could take a quick look at the project and let me know what they think I'd be really grateful - even after reading all the posts on it, I'm still a bit confused about what Tilemap actually is...

  • Yeah it's possible

    Take a look a this

    on layout sized 8192x8192 in my setup i have less then 90 object.

    You could get only one tilemap for all tiles.

  • Sounds ideal! (I'm planning to add corridors and tunnels to mine too, let me know if you find any good methods for generating them!)

    So the tiles are still treated as individual objects with the Tilemap (ie I can assign different variables, etc to different types of tile), and the Tilemap's effectively like an array that contains them? Just trying to get my head around how it works!

  • To be honest with you, I'v been studying your previous file version about making rooms xD. I'm dumb as hell with procedural level generation hehe

    For your question. Not really, Tilemap is one object and all tiles in it are just different parts of image - every part have own id number. So you can't set variables for each tile.

    However your file is ready for tilemap with your current array setup.

    In event nr 31 for Map| Value at (x,y) = X you just need to change "create object" to Tilemap | Set tile (x,y) to tile X and its done.

    And then you can use array to store all values for tiles (like variables for sprites) and use this values when something is happening to specific tile.

  • Just trying some things out with it, looks good... so should I actually be using two tilemaps, and set one as a solid for the walls and the other not for the floors?

  • Yes

  • OK, there's one thing I'm having a really hard time with:

    I need to test if a sprite's X and Y are over any filled tile on the Tilemap, but without using "Sprite is overlapping" as the detection isn't fine enough. I've tried all sorts of variations with PositionToTileX, TileToPositionX, SnapX etc and now my brain's just turning to mush... <img src="smileys/smiley11.gif" border="0" align="middle" /> My Tilemap is 16x16 if that helps

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Exactly! Ha, I was doing it backwards, trying to base the condition around the sprite. Thanks!

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