How do I Make a layering system for a top-down game?

Get help using Construct 2

Post » Tue Mar 01, 2016 12:12 pm

Message: LudvigMarten can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Picture of the game:
http://imgur.com/QjjKKbw

So I'm currently creating a top-down game, sort of. Have a look at the image I linked. I've figured out a way to make the player be on top of an object;

obj.Y < player.Y --> obj move to bottom of layer
obj.Y > player.Y --> obj move to top of layer
(I have the player and the objects on the same layer).

However, this requires incredibly many events because it has to be made for every single object + if i have an enemy (or anything else moving around for that matter) i have to do it all over again!

I hope that someone has a solution to this because I can't figure it out myself. Thanks in before-hand! :D
B
9
S
1
Posts: 26
Reputation: 731

Post » Tue Mar 01, 2016 12:34 pm

Being able to use families would be really useful here, then you could just add all the objects that would need sorting to a family and use a single event or pair of events.

I'm not really sure what would be a good way to approach it without that. I'm just coming up with terribly tedious solutions, like storing the objects grouped by y position and updating the sorting on players vertical movement.

I think moving the player rather than the object could yield better results because you could avoid props potentially snapping through each other. but that's a minor sidenote
B
8
S
2
Posts: 32
Reputation: 620

Post » Tue Mar 01, 2016 1:15 pm

damousey wrote:Being able to use families would be really useful here, then you could just add all the objects that would need sorting to a family and use a single event or pair of events.

I'm not really sure what would be a good way to approach it without that. I'm just coming up with terribly tedious solutions, like storing the objects grouped by y position and updating the sorting on players vertical movement.

I think moving the player rather than the object could yield better results because you could avoid props potentially snapping through each other. but that's a minor sidenote


Thanks! Forgot about the 'Family' function. Going to try it out!
B
9
S
1
Posts: 26
Reputation: 731

Post » Wed Mar 02, 2016 1:19 am

This can simply be done with:

Code: Select all
For each object (ordered by object.Y) > object move to top
B
83
S
22
G
15
Posts: 1,039
Reputation: 15,219


Return to How do I....?

Who is online

Users browsing this forum: mekonbekon, Yahoo [Bot] and 7 guests