Beat 'em up z order question

0 favourites
From the Asset Store
Beat'em Up / Platformer in 2D sidescrolling style template
  • So in my game Psi, I'm trying to create a force field effect. The problem is getting the enemies on the far side to be behind it instead of in front of it in the z order. Here's what it looks like:

    <img src="" border="0" />

    Anyone have any ideas how to get the zombies to the right of the force field to be behind it without throwing off the overall z order?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Why didn't you use family on these enemies and do action as move behind the force field with event like on collision or compare distance by instance variable.

  • What do you mean by compare distance with instance variable?

  • Joannesalfa

  • Each enemies should check distances between enemy and player to compare more like it's alternate collision if you modified collision polygon.

    By the way, I'm working another beat 'em up game for mobiles, if you would like to share our experiences, PM me.

  • Thank you, sounds good! Are you having wacky issues with z ordering your game? I find there to be a lot of conflicting variables...

  • Not really, so tell me what's your current method about variables for z order.

    Z order to each enemies was very easy to implement in correct way, it worked perfect on my game.

  • Here is the basic event:

    <img src="" border="0" />

    The trick is that I'm using regular sprites for the collision boxes and spriter objects for the actual animations. One problem I'm having, for instance, is keeping the range attack of Psi in the right z order. The actual collision box for the attack is generated from the box around her shadow so it's at a lower level than her visible blast attack.

  • Use extra layers in your layout? Put elements you want to be always on top regardless, on the top layer.

  • That wouldn't work because I want the characters on the front side to be in front of it and all of the characters still need to keep the relative z order. I still haven't solved this problem. Seems like a tricky one to me. :(

  • Did you try using instance vatiable to set Y value for current sprite and then sort Z order? something like that

    create instance variable "z" for family Boxes


    every tick -> Sprite | Set "z" to self.Y

    System: For each Boxes order by Boxes.Z ascending > Boxes | move to top of layer

    this way you can specify Z order for every single object using

    every tick -> Sprite | Set "z" to self.Y+15


    every tick -> Sprite | Set "z" to self.Y-150

    or whatever you like.

    Even if sprites image point will have Y=50 you can set this Sprites Z to let say 150 using Set "z" to self.Y+100

  • For each sprite, use their Y position to project the X intercept coordinate of the force field. If Sprite.X is less than the projected X, move it to a layer above the force field. Otherwise, move it to a layer below.



  • Thanks! I'm going to try this!

  • zatyka In order to keep my fragile z order intact, I am trying to modify the events you shared with me to move ONLY the forcefield. Here's what the events currently look like:

    <img src="" border="0" />

    If I moved the individual sprites to the layer above or below or even move them up and down within their own layer, it throws the whole z order off. Can you see what I'd need to change in my current code to make this work? Thanks so much!

  • Thanks everyone for your help but I ended up making an entirely different forcefield effect in Spriter. I think what I was trying to do may be impossible because you had to have both ordering by y and by x and the two were, inevitably, in conflict. Here's a screenshot of the alternative effect I came up with.

    <img src="" border="0" />

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)