ikazuchi's Recent Forum Activity

    I feel like I'm overlooking a basic feature of Construct 2, but I can't seem to find the info anywhere on this.

    Is there a way to set the Z Order of sprites on a layer relative to their Y position? I'm trying to have an isometric game where humanoid sprites can walk in front of and behind each other

    This is my solution using a loop method already in Construct 2:

    + For each Family order by Family.Y ascending
    -> Family: send to front[/code:1e81tt2n]
    
    Make a family "foo" and add sprites into that family.  Sprites in those family will have to be in the same layer in order to pass in front and behind one another.
    
    I'm sure there're other methods but this is the easiest one.  Maybe use this one as a prototype and see if it works for what you have.  Then as you move on and your sprite movement get more complex, you can play around with some other looping method.
    
    If your sprites have simulated depth, you'll just have to offset the origin point for that sprite.  For example, if you have a bridge, and since there is no Z in 2D, technically the bridge section is just placed Y+100 from its origin.
  • 'For each ordered' is a good way - it's not CPU intensive if it's not nested with any other loops.

    Sort by Y co-ordinate:

    + For each Sprite order by Sprite.Y ascending

    -> Sprite: send to front

    Just touching up on this old subject. With the loop above, it only works for instances of an object because you are forced to pick one. In Construct 2 (not classic), to have the loop set Z ordering for multiple objects, create a family of those objects then:

    + For each Family order by Family.Y ascending

    -> Family: send to front

    The only caveat is they all have to be in the same layer.

  • Davemon

    I remember reading somewhere in the forums recently that creating an object via expression -- not by forcibly picking the object -- is a security flaw when Construct 2 obfuscates the javascript code during export. The object name and properties would be revealed and your game can be reversed engineered, so Construct 2 opted to remove this feature. The answer was from an official Construct 2 developer.

    I do wish there was an option in the preferences that we can check 'I DONT CARE about people stealing my game code' that enables this feature, but I think the the reverse engineering goes deeper than just protecting our games; maybe protecting Construct 2's proprietary codes.

    Like you, I am left with the answer of creating a super sprite sheet, and tons of IF ELSE statements to control object properties.

  • I just want to touch up on this old subject. I was experiencing the same problem today and found the fix in the Cordova export options.

    Uncheck 'use WKWebView on iOS (faster performance)' and pathfinding should not crash anymore. Glad it was a simple solution. Though I'm not sure how much of a performance is gained/loss, but project filesize is significantly smaller as well with it unchecked.

    Would be nice to know what WKWebView does. Is it a wrapper?

  • Thanks newt and AllanR... it makes perfect sense now!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I created a For Loop inside a Function to dynamically generate three text box, each with a consecutive number.

    Right after that For Loop, I try to pick one of the text object based on its instance variable and set the text to 'A'. This renders unsuccessful as it seems as if the generated objects doesn't exist.

    drive.google.com/open

    However, if I place the code that selects the instance outside of the Function, it's able to see that the text objects exist and changes one of them to 'A'.

    drive.google.com/open

    Does anyone have an idea why picking instances won't work inside the function, but does when it's outside of it? THanks!

ikazuchi's avatar

ikazuchi

Member since 15 Feb, 2017

None one is following ikazuchi yet!

Trophy Case

  • 7-Year Club
  • Email Verified

Progress

8/44
How to earn trophies