sprite overlapping

For questions about using Classic.

Post » Sat Apr 30, 2011 5:41 pm

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 :P
B
24
S
9
G
2
Posts: 294
Reputation: 3,160

Post » Sat Apr 30, 2011 5:48 pm

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.
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Sat Apr 30, 2011 6:10 pm

I don't know, why it works, but it works. Thanks Arima!
B
24
S
9
G
2
Posts: 294
Reputation: 3,160

Post » Sat Apr 30, 2011 6:38 pm

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: viewtopic.php?f=8&t=6185#p49293

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.
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Sat Apr 30, 2011 6:46 pm

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 :P.
B
24
S
9
G
2
Posts: 294
Reputation: 3,160

Post » Thu Apr 14, 2016 4:21 am

@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... :(
Image
B
25
S
9
G
2
Posts: 534
Reputation: 4,653


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests