Randomly Generated Tilemap

0 favourites
  • 7 posts
From the Asset Store
Enchanted Forest & Cave 16x16 Tilemap with Environment Sprites
  • So until now, I have not touched the tilemap. I have heard many good things about it though, so I decided that I wanted to make a randomly generated city with a tilemap for the sidewalk that the player walks on. I wanted to make it so that each tile on the sidewalk is randomly selected from 17 different tiles on a tilemap, but I don't even know where to begin.

    Link to what I tried so you know what the heck I am talking about: drive.google.com/file/d/0B1VrguiWk

    WC6U0txM3ZHcE5aZ3M/view?usp=sharing

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There's a discussion and some solutions on this thread:

  • There's a discussion and some solutions on this thread:

    Sorry, but I don't think that you quite understood what I was asking. Maybe that is my fault, but now I have to explain myself.

    I put a number of tiles on the layout, and I want to go to each and every tile at the beginning of the layout and give it a random tile from the tilemap. But at the moment, I do not even know to select an individual tile. So... How can I select every single tile in the layout?

  • Tile IDs

    Each tile in the tileset has a zero-based index to identify it. This starts with the top-left tile and increments horizontally in rows. The tile ID can easily be seen by hovering the mouse over a tile in the Tilemap Bar. The tile ID is useful for comparing or setting tiles at runtime with the object's conditions, actions and expressions.

  • I get the feeling my point is still not being understood. I am going to try really hard to explain this.

    You see that thing?

    That is one tile. There is a lot of tiles on the layout at the moment, as you can plainly see. What I want to do is make each get a random tile from the tilemap, but I do not know how to make a loop that selects each tile on the layout. Can you please explain to me how I am supposed to do that?

  • You've got the right idea, but:

    1. Your loop won't work because you're basically saying "when the game starts, for each tilemap object do this". There's a single tilemap object in the layout so it's only going to run once.

    2. The "set tile" grabs a tile by number on the tilemap object and not by X/Y position in the layout. So instead of doing what you're doing, you have to do this:

    Hope that helps!

    Edit: My mistake, in the loop I used "from 1 to 53" but it should really be "from 0 to 52" since 0 can also be a tile position in the tilemap. I uploaded a new image and edited it.

  • Oh my freaking gosh THANK YOU <3

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