# Tilemap: Connect two existing Tiles with other tiles...?

Get help using Construct 2

### » Sun Mar 12, 2017 7:42 pm

Question, cause I feel quite dumb at the moment.
I have a tilemap on the layout with randomly placed two tiles, one near the left edge and one near the right edge. Tiles A and B can have random Y placement.
How can I connect those tiles (procedurally) to form some kind of a bridge / landscape. Like blue crosshatched area on the image.

So far I've been using few different things to get some results and only using EasyStarjs pathfinder gave me nice results but for me it still looks a bit to flat.
B
160
S
69
G
44
Posts: 2,611
Reputation: 36,844

### » Sun Mar 12, 2017 8:30 pm

This is what I can get using EasyStarjs to find a path between A and B, But EasyStar is pretty straight forward. I would like it to be more rough and not simply that flat.

B
160
S
69
G
44
Posts: 2,611
Reputation: 36,844

### » Sun Mar 12, 2017 8:36 pm

Is the tilemap a side-scrolling map or a top-down one? I assume the former from your image. (edit: I saw your second post after posting this one, obviously sidescrolling)

Here's a capx example:

https://www.dropbox.com/s/nhwqq14d716xy ... .capx?dl=1

Basically for bridges or straight slopes you only need to use the a or m (slope) parameter of a linear function. You go from the lower x to the upper x and add a to Y with every loop iteration.

For filling terrain of a random height you need to nest a loop that will fill terrain from the bottom to it top (or vice versa) within the loop going from the lower x to the upper x. Every time you go to the new x you pick a random Y that will be your top.

With some tinkering you can also clamp the random Y's so that the height difference between x and x+1 is of a given maximum. Basically something like Y=Y+floor(random(0,3)*choose(-1,1). That will generate the height at the next X position at most 2 tiles lower or higher than the previous x position. The terrain would be more even yet still jagged at places.
B
15
S
6
Posts: 85
Reputation: 1,195

### » Mon Mar 13, 2017 11:10 am

@Pulstar Hey, thanks for the answer. I've been doing it very similarly but using For loops. Unfortunately in mine as well as in your version I can't get it "look" nicely after autotiling it. It leaves columns of single tiles that don't look too good :/
B
160
S
69
G
44
Posts: 2,611
Reputation: 36,844

### » Mon Mar 13, 2017 5:53 pm

B
98
S
36
G
131
Posts: 5,521
Reputation: 83,505

### » Wed Mar 15, 2017 10:17 am

@R0J0hound Hey, thanks for those articles. Very a nice read. Didn't go deep into the capx yet but it looks like that's exactly what I was trying to do.
Thank You again.
B
160
S
69
G
44
Posts: 2,611
Reputation: 36,844