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

0 favourites
  • 6 posts
From the Asset Store
Piano tiles
$9.99 USD
Template for a piano tiles game, fully documented in comments and video
  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

  • 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 :/

  • 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.

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