layering thing

For questions about using Classic.

Post » Thu Jul 16, 2009 3:36 pm

In MMF there was an object called the "layer object" that could do things like, sort all the objects/sprites according to a private variable - so you could make it so that the higher the variable then those objects would appear in front of objects with a lower value.

I tried doing something similar by:
always - start loop "sdf" 100 times

then if sprite variable = the loopindex "sdf", then send to front

but this seems to slow the game down a bit?
B
143
S
72
G
19
Posts: 1,777
Reputation: 21,702

Post » Thu Jul 16, 2009 3:45 pm

Compare the layer the sprite's on, don't use a private variable; considering using families.
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Thu Jul 16, 2009 4:56 pm

Isn't that what 'for each' (ordered) is for?
Moderator
B
92
S
32
G
33
Posts: 3,005
Reputation: 27,592

Post » Thu Jul 16, 2009 6:53 pm

Arima is right, something like:

+ For each Sprite order by Sprite('var')
-> Sprite: send to front

Then you can use any value you like to arrange the layering, eg. .x + .y, size, speed, anything!
Scirra Founder
B
386
S
229
G
87
Posts: 24,198
Reputation: 191,524

Post » Fri Jul 17, 2009 10:36 am

thanks you guys are breathtaking. I thought that for each ordered thing would be useful one day.
B
143
S
72
G
19
Posts: 1,777
Reputation: 21,702


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests