Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(2 edits) (+1)

Check the creation code of the room and you'll find this bit, this is what arranges the objects in 3D space:


The idea is that the level is arranged in chunks 640 pixels wide (for this room in particular - you can use whichever value you want here), every subsequent chunk is put on top of the previous one.


There's a handful of backgrounds for different grid sizes which can be used to help judging distance, the one used in this room is 640 pixels wide. (I've tried an approach where multiple floors are on different layers for a different project but IMO it's an even worse experience since there's no depth perception)

If you're really sure you wanna do this with layers instead, you could try changing the lines in terrain_flat_to_3d from

z = 64*(x div global.level_chunk_width)
x =     x mod global.level_chunk_width

into

z = 64*(depth div 100)

so the depth value (which is obtained from the layers by default) is used instead. (In this case you probably want to start from a fresh room - by default layers have their depths spaced 100 units apart but the layers in the dungeon_test rooms use compatibility values)

(2 edits)

Hey, I tried using the code you mentioned, and for some reason it results in anything i place higher than the first layer actually being LOWER

i made a new room and put in the CONTROL object and a floor and a couple of walls on the first instances layer, then made a new one on top with a few walls, and for some reason all those walls are actually lower than the things on the bottom layer

this even seems to happen even if everything is on the same layer, with the walls always being below where they should be for some reason (just to a lesser extent)

(1 edit)

I messed around a bit and got very weird results, after a while I think I figured it out. There's some legacy shenanigans going on with the depth values, so you need to explicitly read them from the layers. This version of the code seems to work as intended:

z = -64*(layer_get_depth(layer) div 100)

But you also need to do two more things:

  • CONTROL currently changes its depth value in the create event, cut this line and paste it in the Room Start event (otherwise it gets an extreme depth value which in turn messes up where the player spawns on the Z axis)
  • Likewise, all of the "floor" objects sets their depth to 0 in the create event, remove this entirely.