0 Favourites

Z Order on Side Scroller

  • Hi Guys,

    Im working on a 2d side scroller game. Im trying to make it somewhat 3D as the player can walk up and down, as well as side to side. I cant figure out how to manage the z order of all of the objects and enemies at run time. I want the the player to be in front of an enemy if his y position is greater than the enemies y, and i want all of the enemies to do the same thing with each other and the background objects. Is their a way to manage this that wouldn't crush the framerate? I tried using families and I just cant seem to get it to work. Thank you for any help!

    Adam

  • I've been wanting to do a similar "Double Dragon" style beat-em up style and run into the same problem. The only way I can think to reduce framerate issues is to use a combination of layers for static objects and the dynamic layering stuff only for objects that can change their Y (players and enemies usually). Generally both the background and "ground" can just be a flat image on the bottom layer.

    If you find a better solution, please share it!

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Perhaps a Y position comparison for each object in combination with the "Move to Front/Behind" action will solve your problem.

    See this example capx. It demonstrates a different issue (how can an enemy first come in line with the player and then start to move towards him/her) but it also follows the "Move to Front/Behind" principle (although somewhat limited in power).

    http://www.eli0s.com/Tests/DoubleDragon.capx

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