I'm aware of using the layer object to sort objects by their Y value to create a fake 3D environment.
However, I'm not quite sure how to pull this off with regards to diagonal objects.
Something like this:
http://imgur.com/8diArJn

I'm aware of using the layer object to sort objects by their Y value to create a fake 3D environment.
However, I'm not quite sure how to pull this off with regards to diagonal objects.
Something like this:
http://imgur.com/8diArJn
do the angle change in runtime? If not, cant you just order normally?
This is a is a prime example of the problems you find in pseudo 3D games. Since you only have one positional value to test against on the angled object you need to either:
1. Put the hotspot on the lowest point of the angled object and accept the object will always overlap the player.
2. Put the hotspot On the highest point of the object and accept the player will always overlap it.
3. Cut the object into smaller pieces (the same width of your player is ideal) so each piece will sort more accurately.
4. Don't allow the player to overlap this object by using a separate collision shape.
There is no ideal solution tbh.. You just need to be clever.



I usually do a bunch of "object is in area x y" ---> move in front of/behind player...or the lazy solution...i draw 2 masks and place them on the play area...mask 1 puts the player in front of objects and mask 2 behind the objects...could be tedious though if there are lots of different rooms

Hm, doing it manually did cross my mind. But then other actors (enemies, etc) will also have to be done manually and creating masks for every angled surface... that work will add up.
Something I toyed with is putting the hot spot at one end of the wall's base and the action point at the other end and trying to calculate it that way, but I couldn't find a good solution that way either.
diagonal walls are a real pain in such sitations
I would avoid them completely... or split them in smaller entities, like mobichan suggests
a good depth sorting solution can be (likely) pulled out if your pseudo 3d game is tiled and every element has the same size
if this is not applicable, I would consider making detection zones as Klownzilla suggests
(you could use a value for sorting, say Z, and set it to Y(object)
then players overlapping front zone get a +wallOheight bonus)
but then you should design the stage in order to not have other conflicting objects in the same area,
like another wall in front of player staying behind, or a character overlapping another and one of the two not triggering the zone bonus
depth sorting in a 3D environment is not trivial unfortunately,
it requires a lot or testing and computation
(see Z-buffering, bsp trees, painter's algorithm...)
you could even build up something like that, if you don'thave loads of elements,
fire a loop for each object, and do a serie of test (nested loops) with overlapped objects,
that will determine a "catalogue" of the single elements (who/what is in front or behind who/what)
basically by determining if above or below its "base line" (some math would do)
and then make a final score to assign general depth values for the layer object
..or simplify your model to avoid all those issues of a 3D space![]()