Isometric games and variable depth

Get help using Construct 2

Post » Thu Jun 25, 2015 5:37 am

Hey there!

Just decided to make the switch from GameMaker to Construct 2 (mainly because of delta time) and have been slowly getting a hang of the event-based system, rather than object based.

I'm making an isometric rpg-like game. One thing I'm completely stuck on is how to make different sprites pass in front/behind each other depending on their y value.
In gamemaker it's just, every tick : depth = -y

I found a tutorial that looks like it sort of works? https://www.scirra.com/tutorials/1165/z-ordering-on-a-isometric-grid
but I don't really understand it... You have to check if two things overlap, but then you have to do that for every single pair of sprites? I tried to put it a family but does it check if a specific instance passes in front or behind another?
on collision > compare values - sprite1.y > sprite2.y : sprite1.y pass behind

Is there no way access built in variables for objects? You can set the x and y of something why not the z? And like reset the z every tick. Or is that going to slow the game down?

Actually someone here mentions it https://www.scirra.com/forum/isometric-multiple-floors_t121850
"Z-height = y offset" but I have no idea how to apply that to the event system

Anyway, thanks for the help in advance, I really like the engine overall so far!!

olga

(ps. how do I get links to work?)
B
8
S
1
Posts: 5
Reputation: 364

Post » Thu Jun 25, 2015 6:45 am

A lot depends on how you have set things up..

Usually an:

player "on collision" with thing
--player.y < thing.y
> thing move to object - in front : player
else
> thing move to object - behind : player

does the trick if before executing this triggered event the z-ordering is correct..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Jun 25, 2015 1:56 pm

Thanks for the quick reply!

Hmm yea I guess I see how that would work, but does this mean I have to set up this check for everything on the screen that is moving? I have a couple characters and enemies, just wondering if there is any shortcut.
B
8
S
1
Posts: 5
Reputation: 364

Post » Thu Jun 25, 2015 2:02 pm

Another solution is to use for each and place all the things that you need to sort in a Family.

For each Family1 order by family.Y ascending > Move to top of layer.

This is a shortcut but can get very heavy since it will sort all objects every tick.
Follow my progress on Twitter
or in this thread Archer Devlog
B
40
S
17
G
17
Posts: 991
Reputation: 12,654

Post » Thu Jun 25, 2015 3:06 pm

Ah sweet, yea that makes sense. Thanks!
I'll use it for now and if it starts to get slow, figure out something else I guess.
B
8
S
1
Posts: 5
Reputation: 364


Return to How do I....?

Who is online

Users browsing this forum: beohs, Elliott and 17 guests