How do I Affect Z ordering based on Y position?

Get help using Construct 2

Post » Sun Sep 20, 2015 2:55 pm

Hi, Im struggling with a problem that I'd be very grateful for help with.

In my game flowers (one object) appear at random places within a set area, I am trying to make it so that when a new instance is created it detects if there will be an overlap with an instance of that object that has already been created, check its y-position and then if the new instance has a greater or equal y-position it'll move the new instance to the top in the z order.

I hope that makes sense?

Effectively I am looking to make it so that when a new instance of an object is spawned it'll place it either in front of or behind previous instances based on how high up tghe screen they are - giving a sense of depth.

Everything I've tried so far hasnt worked as Im dealing with instances of the same objects (I can do it if its sorting between different objects!)

Thanks
B
4
Posts: 9
Reputation: 216

Post » Sun Sep 20, 2015 3:19 pm

I think I actually just got it (or a crude version at least!)

On create> add sprite.Y to YInstanceVar

On Sprite overlap + Pick High/Low instance variable > pick Highest from YInstanceVar > Move to Top Layer

It kinda works :)
B
4
Posts: 9
Reputation: 216


Return to How do I....?

Who is online

Users browsing this forum: MassimoF and 28 guests