-
[help] depthsorting
I've got a quite embarrassing problem. I don't know how to properly sort my objects for this tilebased game I got. I'm using the formula
depth = y *maxX +x
but that's just temporary as I want to be able to place more then one object at the same tile. Actually it's not hard to figure out how to fix it - the real problem lies in the fact that flash swaps depths if the depth specified is already in use. Therefore it works sometimes depending on which depth the other mc got.
I made this example, and I'm attaching the .fla aswell.
-
1 Attachment(s)
It's a classic - I forgot to attach the file :o
-
give each mc a unique number (num). count all the mcs (tot)
(y * maxX) + (x * tot) + num
-
Thanks, but it still won't work perfectly :/
When two objects are on the same tile the one with the highes unique number will always be on top.
updated swf
Edit: Sorry, sorry - I got it to work. I wish there was a more efficient way then reassigning their depth every frame though. Thanks blinkOk.
-
Hey kianis, i remember your game of the last 48 hr comp, it was amazing, the idea was very original and the collision detecting was nice. I haven't seen you in the actual 48 hr comp forum, are you going to participate?