Trouble with pseudo Z axis

This forum is currently in read-only mode.
0 favourites
From the Asset Store
A well commented Pseudo 3D Racing game template to learn from or use as a base for your own game!
  • well it works, but i found a prob with it which im trying to fix, things on the ground layer can never be infront of things on the high layer so a tall object will get clipped, the only other way i could forsee this being fixed is by having a for each by sprite y for each ground level box, and then using subevents to sort through each of the ground level sprite's z children, from the bottom up, there for making the base of these z heights the bottom of the stack catch mah drift?

  • I sort of get what you mean, it's similar to the method i'm trying at the moment, which is basically a nested loop:

    for "layers" from 0 to 128 (or maximum Height)

    ---For each terrain

    ------If private value ZHeight = loop index of "Layers" --- bring to front

    but i think with tall/floating objects i will run into the same problem you have

  • Another problem someone might be able to help me with is the 'Pick by largest private variable' thing.

    Here's the cap of my game so far, if you press V it'll go into like a debug mode (which i haven't made a toggle sorry lol) anyway when you mouse over the red things, if you hover over more than one it's supposed to choose the one with the highest ZHeight variable, and it's coded to do so, yet it only picks the highest one on some of them, others it won't choose the highest one until it's the only one being overlapped


    i made a quick example using the EXACT same code and it worked fine, i put it in here and it doesn't work, i dunno why

  • Sorry bout all the posts, but I figured out why it's not working, the pick by largest variable wasn't doing ANYTHING when in the same event as an 'is overlapping' event, you don't even need it there, the program was using UID's by the looks of it to determine which object's height had priority

    So i fixed the problem, just make the high terrain first, smaller bits last

    But really, if there's a 'pick by highest variable' event in an 'is overlapping' event, shouldn't the variable override the UID?

    ...and now i'm back to the sprite ordering problem again...

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Sorry, i know it isn't really forum ettiquette to post four times in a row, but i still really need help with this

    So far the best results i've got have been with:

    For each Blue ordered by Blue.Y + Blue.Value('ZHeightBottom') ascending

    which gets the X,Y layering working great, as long as i don't stand on anything

    if there is any way of combining that above code with this code:

    For each Blue ordered by Blue.Value('ZHeightBottom') ascending

    which gets the 'Z' layering working great

    Because both effects are what i want, but i want them at the same time, for now i only know how to apply them separately

    i'm desparate! this is like the last (maybe second last...) bug for me to iron out in my engine so i can start on concept, art and story

  • Every time I see this thread bumped it makes me sad because I want your game to work, and it just doesn't. Then I open the .cap and struggle with it for a little while and tear my hair out and it all ends up nowhere.

    I think it might just be impossible. I've come up with a few solutions that I was absolutely sure should be working, but they just didn't, and the whole thing just makes no sense to me.

    I hope someone is able to help.

  • Just loop every blue by

    Blue.Y + Blue('ZHeightBottom') * 2

    And bring to front. That works perfectly.I'm just looking over your code because something is up with collisions

    Edit: Arg that has problems when you jump on large objects...okay let me think this over

    Edit: Okay I think theres a bug in the collisions causing me to walk through walls...looking into it

    Edit: Very use lots of objects like motion detectors and stuff...I dont understand why...and when the player jumps the detectors seem to stay on the ground. Your method of disabling physics with the bodies is correct, and my method of z order is correct, but theres something wrong elsewhere

  • Just trying to read this thread hurts my brain so bad... I would be of no help at all I don't think, especially if Deadeye and Davo can't figure it out. :S

    I feel bad for you though, since the idea sounds wicked... good luck though bro.


  • Dave, I dunno how but you seem to have fixed my problem with the exception of jumping in front of the tower i made in it and jumping when behind one of the big boxes, it acts a little funny...

    The collision thing, as far as i'm aware, is when the player overlaps the obstacle just as the player's bottom variable falls below the obstacles top variable, which shouldn't be possible in theory as the collisions are reset if that happens...

    Also a similar thing happens with disabling the collisions, when the player is pushing against a wall and tries to jump over it, he stands on top of it but cannot go any further than the edge, as though collisions are still active, if you get a run up however that problem doesn't exist

    I was going to make a little loop that pushes the player out of the colliders when he shouldn't be there, but i found with that loop, when pushing against an object from the LEFT ONLY, the player constantly gets pushed out and twitches

    I also made the detector things stay on the ground because the collision objects aka, 'footprints' of the obstacles are always going to be on the ground

    I'll post a more up to date cap right now, i've cleaned a little of the code up and got rid of a few useless detectors.


    Thanks for the help everyone! we're slowly getting there

    Soon i can start the real work....

  • Awesome, you finally got it working

    I played around with it a little, it seems to be pretty solid, other than the tower glitch you mentioned. Just one thing though, now that the level is more complicated it's harder to discern where the blocks actually are. Maybe you could do some different lighting on them to help readability? Something like this maybe:

    <img src="">

    Just a thought. Orthographic views can be kind of confusing sometimes.

  • Yeah those boxes are just old sprites i made for something else, i just threw them in for something to use, and the player is just a placeholder as well, once i get a character made in lightwave/blender/truespace (whichever i decide) i'll render animations and walk cycles in ALL 64 DAM DIRECTIONS which will take years to get working in construct (hence my animator bar suggestions a while ago )

    Anyways yeah, these are all placeholder type sprites and the only two glitches i can find in the Z layering are jumping in front of the tower and jumping when behind the big box

    I don't really know how to fix those ones.....

    Any suggestions from the almighty devs?

    Also, deadeye, what are you doing with the lighting there exactly? it does look pretty cool, i was thinking of eventually making just some generic semitransparent shadow objects that i could put in different places like walls and floors to give more depth and realism to the scenes

    dynamic lighting had occured to me too but i dunno how well it would go down as it's not really a top-down/side-on type view

  • Eh, it was just a mockup I photoshopped really quick. Some white rectangles on the front face set to overlay and like 40ish percent layer transparency, just to differentiate the front faces from the top faces.


  • i tryed adding a simple shadow caster, it works pretty well, cept for the floating box

    all you have to do is add shadow caster to the red "base" squares and then create a light on the "shadow" layer which always postions to the player

  • yeah that looks ok, not really the look i'm going for though, in any case i'm gonna leave the lighting and sprites till i get this layering problem 100% fixed, right now i'd say it's at about 90%

    the '* 2' certainly helped out a bit although i'm not entirely sure how.

    So if anyone has any more ideas i would gladly welcome them?

    Am i even doing this the best way it could be done?

  • Okay, I just read a thingy about this sort of stuff here:

    They were having trouble with draw order for their isometric engine. The solution they came up with was something like this:

    Set the draw order for each object to (Y increment*100)+(Z increment). Then draw each object according to it's draw order.

    So if there's a block at Row 2, Z 1 then it's draw order would be 201. And if there were a block at Row 2, Z 2 then it's draw order would be 202, and since it's higher it gets drawn on top.

    So if I'm understanding this right (and I might not be ), all you'd need at that point is:

       -Set value('draworder') to (Y*100)+Z
    +For each Family Z ordered by value('draworder') Ascending
       -Bring to front
    Just one little loop 
    This will apparently only work with single-unit blocks, so the large block you have will have to be chopped up into smaller blocks that are treated as individuals (but you could easily disguise that with clever tiling).
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)