How do I Make a layering system for a top-down game?

0 favourites
  • 4 posts
From the Asset Store
Set of tiles to create a map for top-down games with island theme
  • Picture of the game:

    imgur.com/QjjKKbw

    So I'm currently creating a top-down game, sort of. Have a look at the image I linked. I've figured out a way to make the player be on top of an object;

    obj.Y < player.Y --> obj move to bottom of layer

    obj.Y > player.Y --> obj move to top of layer

    (I have the player and the objects on the same layer).

    However, this requires incredibly many events because it has to be made for every single object + if i have an enemy (or anything else moving around for that matter) i have to do it all over again!

    I hope that someone has a solution to this because I can't figure it out myself. Thanks in before-hand! <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy" />

  • Being able to use families would be really useful here, then you could just add all the objects that would need sorting to a family and use a single event or pair of events.

    I'm not really sure what would be a good way to approach it without that. I'm just coming up with terribly tedious solutions, like storing the objects grouped by y position and updating the sorting on players vertical movement.

    I think moving the player rather than the object could yield better results because you could avoid props potentially snapping through each other. but that's a minor sidenote

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Being able to use families would be really useful here, then you could just add all the objects that would need sorting to a family and use a single event or pair of events.

    I'm not really sure what would be a good way to approach it without that. I'm just coming up with terribly tedious solutions, like storing the objects grouped by y position and updating the sorting on players vertical movement.

    I think moving the player rather than the object could yield better results because you could avoid props potentially snapping through each other. but that's a minor sidenote

    Thanks! Forgot about the 'Family' function. Going to try it out!

  • This can simply be done with:

    For each object (ordered by object.Y) > object move to top[/code:211q1v6z]
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)