Randomly Generated Tilemap

Get help using Construct 2

Post » Sun Oct 16, 2016 3:50 pm

Message: DerpyDev can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
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: https://drive.google.com/file/d/0B1VrguiWk
WC6U0txM3ZHcE5aZ3M/view?usp=sharing
B
8
S
1
Posts: 20
Reputation: 449

Post » Sun Oct 16, 2016 9:03 pm

There's a discussion and some solutions on this thread: simplest-way-to-generate-random-dungeons_t182757?&hilit=tilemap
B
46
S
16
G
74
Posts: 2,089
Reputation: 44,187

Post » Sun Oct 16, 2016 10:04 pm

Message: DerpyDev can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
plinkie wrote:There's a discussion and some solutions on this thread: simplest-way-to-generate-random-dungeons_t182757?&hilit=tilemap


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?
B
8
S
1
Posts: 20
Reputation: 449

Post » Sun Oct 16, 2016 10:08 pm

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.
B
46
S
16
G
74
Posts: 2,089
Reputation: 44,187

Post » Sun Oct 16, 2016 10:22 pm

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?

Image

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? :D
B
8
S
1
Posts: 20
Reputation: 449

Post » Sun Oct 16, 2016 10:31 pm

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:
Image

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.
Last edited by andreyin on Sun Oct 16, 2016 10:35 pm, edited 1 time in total.
B
123
S
43
G
41
Posts: 847
Reputation: 28,206

Post » Sun Oct 16, 2016 10:35 pm

Oh my freaking gosh THANK YOU <3 :D
B
8
S
1
Posts: 20
Reputation: 449


Return to How do I....?

Who is online

Users browsing this forum: jorgmaquoi, R0J0hound, tarek2 and 10 guests