Code Theory - 2D Tileset height and Jumping down ledges.

Hello there guys,

I was wondering if any of you could offer some advice on developing a script or at least the logic behind height while using 2d tilesets.

As a reference think the 2d top-down LoZ games.

Having given it some thought obviously you’d need the jump animation, a collider on the jumpable edges, and perhaps a collider on each height level which dictates to the player wether they can jump down to the surrounding lower terrain.

Have any of you got advice on how to handle this?

If anybody would like to team up and create a demo of this, I’d be happy to do the majority of the coding and release this as a free asset on the asset store.

All the best,
Josh

Well, you’ll likely be using colliders regardless, but the tricky bit you have is not so much that as when to trigger the jump/fall animation. You effectively want a varied collider setup based on your current position, where falls allow you to move into them, but the bottom of a fall does not let you move back into it. Me personally, I’d probably add in a second tilemap that is hidden that manages that and alters what is in said tilemap based on position, but might be a bit overblown a solution.

I did this for my game and the key is using Z on the cells to place tiles at different heights. ( transparency sorting axis for Z and tilemaps on individual mode)

This is an oversimplification but I mulled over how to implement this for months before i reached the solution. ( byte arrays for terrain, how the art needed to look for it to work, upwards autotiling ( 9x9x9 possibilites)

Also I coded my own collisions, couldn’t use unity physics at all. All calculations against byte array terrain.

This system can be used to jump, fly, etc in topdown 2d view