Gamemaker2 and depth - unpredictable

C

Cjohs

Guest
I am trying to get a Hex-tiles system to work with Gamemaker2. (Im not using the builtin tile system)
my overall system is: base-tiles are drawn all over the 124x124 tile map just as sprites.
Then i want to draw location hex tiles on top of those as object instances.
The tiles im using are designed to overlap (so tall mountains and trees can cover parts of the tiles above them.
To get that to work I am drawing using depth, my idea was to have the base tiles draw to even depths (2,4,6..) with a new depth for each horizontal row of tiles so the top row will be "deepest" and the bottom one will be closest.
Then my location tiles (objects) could be drawn on the odd depths (1,3,5) to ensure that they will be on top of the base-tiles and partially covered by neighbouring tall mountain tiles.
But it is not working as expected, it seems that when the engine gets around to drawing the location-objects (in the objects draw event) the calculated depth seems to be off.
Does the engine tamper with depth so I cannot predicts/control which depth a given element is on, even though I specify the depth...? or ..?
 
C

Cjohs

Guest
Ok after reading thru the stuff from @Caique Assis I came up with this solution instead:
I create layers as instances two for each row of the map. I then create an object for each tile and place those on the appropriate layer Base tiles on even layers and locations on odd layers.
However this now introduces a new problem this creation script takes about 1-2 seconds to complete, and the game "dies" during this setup time (after creation the room appears and frame rates are fine).
Now how to display some pause animation for the user to enjoy? It would be nice to call my script asynchroneously but that seems to be impossible.
How do you handle these longrunning scripts without annoying the Player? I would imagine that I could run into this problem with other scripts as well (maybe AI or that kind of stuff)
 
C

Caique Assis

Guest
Can't you make a "loading" screen appear and after that run the script? If it only takes 1-2 seconds to complete, then it's a really small waiting time problem.
 
Top