sprite overlapping

This forum is currently in read-only mode.
From the Asset Store
A set of 10 pixel art animated magic effects with icons. 2 Fire, 2 Earth, 2 Wind, 2 Water, Portal, Explosion.
  • I've created a tree. Told the player to be infront of that tree if player.y is greater than the tree.

    Set the hotspot down to the treeroots. And the same thing I did for player.y is less.

    So the player is behind the object.

    Now, I don't want to make for each tree a new sprite. I take the same tree. But of course

    that method won't work anymore :/.

    I don't want a system like Filmation(like R0J0hound did) lol, it's too complicated. And it's not necessary I think.

    Is there a way to use the same tree sprite and being behind both or even between them?(in the y axis)

    edit: And please don't tell me to make another layer for it xD

    A forest would take too many layers

  • Make a family 'sort', put all objects you want sorted in the family then use the event 'for each ordered' using the sort family, put sort.y in the parameter field, and use the action sort: bring to front.

  • I don't know, why it works, but it works. Thanks Arima!

  • The for each ordered condition sorts all instances of the selected object based upon the parameter entered, in ascending or descending order, so you could also sort via a private variable, for example. For further understand for each, you can read my tutorial here:

    The only difference between 'for each' and 'for each ordered' is with 'for each ordered' the order in which the instances are cycled through is determined by the parameter entered.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Okay..because the y of my player is greater than the tree (if I am below it)

    so I am also greater(higher) than the tree in the sorting order.

    Thanks for the explanation .

  • Arima

    I'm just curious how well this works in a large game where you have many little people running around. It seems like it would be a lot to ask for to have to keep reordering the objects. I've never thought about this problem until now, I originally assumed you could simply change the z order index to some arbitrary number... then you just set z = y or something similar. Also, that way the only thing changing is the objects that are dynamic and you wouldn't have to touch all the scenery...

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