Now there's the thing. Depending on what you are sorting it makes a huge difference. If you look at my depth sorting project on my tutor account, you'll find it uses a binary chop algorithm to speed up the sort. BUT, if the data you are sorting is already almost in the right order, then this method is actually much faster! IKR, I've timed it. So, yes, if your needing to sort a highly volatile set of sprites, then you may do well to use a more clever technique (which I can teach), but most of the time it would be wasted effort it appears.
@@griffpatch Sorting algorithms are really contextual. I mean, if you have just a few sprites - or any amount, honestly, you certainly wouldn't want to use something like Radix sort. But when you're sorting thousands upon thousands of elements at once, Insertion sort is just way too slow.
@@Supyisiscool and the tricks he use are exclusive in the Scratch world. He has show the way to create incredible games (professional!) to thousands of Scratchers !
I love how elegant this solution is. I've never thought that sprites that are in front will run broadcasts first! I've always thought that they will retain their execution order regardless of their layer and it was a dead end for me, but you gave me enlightenment. I love your videos and the sheer amount of effort you put into them! Thanks for these tutorials!
This will improve so many of my games! A lot of my top-down adventure games look rather ugly because of the terrible layering. This was super helpful! I love your childish and energetic style!
This video is immaculate and professional. As new scratcher, I am so glad there are people like you who make videos like these. So easy to understand and follow along. Thank you.
I want to say something. I found something not right while watching this video. I don't know whether other people found this or not. When the cat goes to the front layer pass from the tree...It passed the tree trunk and popped out.. * That does not exactly happen in reality. * In reality, the cat cannot pass through the solid trunk. So, I'm thinking; will that bug be fixed in the next episode?
Man, you're the best. Your sorting script worked like a charm in a scrolling platformer game I'm working on. My layering was a mess, and pieces of the background kept either disappearing or showing in front of sprites where they didn't belong. It was such a headache. Now my layers work correctly *all* the time, every time - it's amazing. I can finally work on what matters in my game now. Thank you so much Griffpatch!
The mechanic that scripts run for the highest layered sprites/clones before moving to lower layered sprites/clones is a HUGE game changer! I'm surprised I never heard about it sooner in my nearly 6 years of in-and-out Scratch experience. You never explained how this works with the background scripts though. Would they take priority over sprite/clone scripts or be the last in line to run? The script you constructed in the video to sort layering was also really helpful as well. I'm working on a Scratch port/re-invention of the Monster Hunter game series in a top-down 2d environment (one I may post on this account) that I planned to use layering for to implement vertical attacks for both the player and monsters. While I'm yet to reach this stage of the game, I have been concerned on how I would implement an effective height system, especially with fluid layer changing that could collide and dislodge other layering. The straightforward and versatile solution you provided almost completely solved all of those problems. My only fear is performance with the complexity I'm already aiming for and the fact that I'm running this on Turbowarp's interpolation (even though that compiles the code into a more efficient state, I'm still fearful). With the script, I am including terrain such as cliffs, trees, shrubs, etc. as clones rather than part of the core terrain feature/collision tiles once I convert from single tile maps. I don't mind reaching the clone limit, of course, since I'm going to design the game around Turbowarp. However, with my plan being geared towards interconnected maps rather than smaller, screen sized maps, I have my doubts that even Turbowarp could handle it with my limited testing of Turbowarp by running 5 Among Us games to cheat and win every time (don't question that). If you have any ideas about improving the efficiency of the layering script (both you, Griffpatch, and anyone else reading), I'd highly recommend advice.
It's been years since I used scratch, but this video popped up and my feed and I clicked on it. Brings back memories and holy frick they completely revamped the UI
Thank you so much griffpatch! I have a big game i was almost finished releasing the demo for and I kept putting off the layering of it. When i finally got around to it, It was a nightmare sorting everything and trying to get it to work properly, but this helped out a ton!
ive been searching through and analyzing every frame of this video trying to figure out where i went wrong but i literally cant find anything that isnt exactly how this tutorial showed it. it just doesnt work.
Same here, when I run the sorter in an infinite loop, my clones sometimes just go back and forth, which looks like flickering when they are layered on top of one another
This is just scratch... I'm afraid it's Scratch switching the editor from one sprite to another... It probably won't happen when the game is played with the editor closed before you look inside. Also, if you change the dragging code to use a keypress instead of the click then that solves the problem... it's not your fault.
Thank you for this! There aren't many advanced tutorials on scratches layering. I am making a top-down shooter game so layering is of the utmost importance. Unfortunately, I am not using this. I made my own layering system a while back that I'm using but this is great stuff!
When the scratch is sus. This is a really great tutorial. Among us in the background. How did you make the scratch cat's 3d at this part: 4:06? I also have camtasia.
im not sure how efficient or if its even functional or applicable on scratch, but maybe it could be done with "go to back layer" and then "go forward (0 - (y position - 200)) layers" or something of that kind to sort in 2d? either way great video, learned a ton. cheers!
Griffpatch, you've definately succeeded with the visuals when you teach these tutorials. Can you make a tutorial explainiing how to make snake, and also introducing grid lists with snake?
7:23 or just a suggestion you could have the sprites set a new variable to their y position, and compare if the order is bigger than 1, before setting the variable, comparing it to the previous position (stored in variable), and, if placed higher up, goes to back layer, on the flip side, going up 1 layer, because they run in layer order, therefore they can compare the variable to their own data edit: i didnt think of doing this because i didnt know they ran the broadcast code in layer order, however i did know they ran in seperately
Thank you! I'm using this for a sokoban game, as I want "floor" objects (like markings on the ground) to layer below everything else, but all the objects are clones in the same sprite
This is so useful to sort layers in projects, I was confusing to sort them in my projects that I'm just using the go to front layer blocks and it fianlly not working but this would just become so useful that you can just enter the layer in the block and it will sort it for you
Hey griffpatch! I have found a way to make it instant, you dont want that cat appearing out of nowhere? Use blocks! Make a block called clone or somthing else, attach it to under the set size to 150 block but remember to take out the blocks below the set size to 150 first then put the block, now put the blocks you just pulled out of, and attach it to the define, not that the block MUST BE WITHOUT SCREEN REFRESH yet it makes a istant meaning instant layering! Now you wont have to need to wait
Why not use a more efficient sorting algorithm?
Now there's the thing. Depending on what you are sorting it makes a huge difference. If you look at my depth sorting project on my tutor account, you'll find it uses a binary chop algorithm to speed up the sort. BUT, if the data you are sorting is already almost in the right order, then this method is actually much faster! IKR, I've timed it. So, yes, if your needing to sort a highly volatile set of sprites, then you may do well to use a more clever technique (which I can teach), but most of the time it would be wasted effort it appears.
@@griffpatch Sorting algorithms are really contextual. I mean, if you have just a few sprites - or any amount, honestly, you certainly wouldn't want to use something like Radix sort. But when you're sorting thousands upon thousands of elements at once, Insertion sort is just way too slow.
@@griffpatch sussy mogus (O3 sus lol
@@hriday684 but it's not too slow if your items are almost in the correct order already. Which is what we have most of the time in scratch
@@hriday684 say contextual but replace conte with se and remove the 2nd t”t”
I like griffpatch's tutorials because you actually understand them. Unlike the other ones, where you just copy everything.
Agreed
@@tankyd8229 True
@@MrPork-he5lz very true
@@Supyisiscool and the tricks he use are exclusive in the Scratch world. He has show the way to create incredible games (professional!) to thousands of Scratchers !
I agree
I love how elegant this solution is. I've never thought that sprites that are in front will run broadcasts first! I've always thought that they will retain their execution order regardless of their layer and it was a dead end for me, but you gave me enlightenment.
I love your videos and the sheer amount of effort you put into them! Thanks for these tutorials!
This is great! My money was worth it to see these tutorials early! Nice Griffpatch!
8 hours ago?!?! This was posted 2 minutes ago.
@@TirzaBoi thy can see the video early cause of their subscription
@@MrPuzzleCodes oh yeah i forgor ☠️
This is one of the best tutorials on the entirety of UA-cam
This will improve so many of my games! A lot of my top-down adventure games look rather ugly because of the terrible layering. This was super helpful! I love your childish and energetic style!
“A complete jumble, a mess of cats!”
That’s the basic definition of half of Scratch’s first projects ( or something like that. ), including me.
This video is immaculate and professional. As new scratcher, I am so glad there are people like you who make videos like these. So easy to understand and follow along. Thank you.
I've already tested this technique and failed miserably. I love this tutorial and all of the ones like it! I wish the best of luck to you griffpatch!
The great thing with griffpatch's tutorials is that they are easy to learn unlike other people who put in as much as possible.
The edits during this video look really neat and make this super easy to understand! Great video as always.
Glad you think so!
I literally trying every single video, keep it up Griffpatch, your tutorials are so helpful
Boy does this guy love the scratch cat, he even put in in the title of the video, and its the main character in almost every video.
THANK YOU SO MUCH FOR THIS! This is the most useful tutorial I’ve ever watched in all of tutorials ever!!
I want to say something. I found something not right while watching this video. I don't know whether other people found this or not.
When the cat goes to the front layer pass from the tree...It passed the tree trunk and popped out..
* That does not exactly happen in reality.
* In reality, the cat cannot pass through the solid trunk.
So, I'm thinking; will that bug be fixed in the next episode?
This is actually very useful, thanks Griffpatch.
i made the 1000th comment so that hopefully this video will get recommended to more people it's such a good tutorial
04:12 AMONG US.
AWESOME TUTORIAL 😄
YES
Man, you're the best. Your sorting script worked like a charm in a scrolling platformer game I'm working on. My layering was a mess, and pieces of the background kept either disappearing or showing in front of sprites where they didn't belong. It was such a headache. Now my layers work correctly *all* the time, every time - it's amazing. I can finally work on what matters in my game now. Thank you so much Griffpatch!
The mechanic that scripts run for the highest layered sprites/clones before moving to lower layered sprites/clones is a HUGE game changer! I'm surprised I never heard about it sooner in my nearly 6 years of in-and-out Scratch experience. You never explained how this works with the background scripts though. Would they take priority over sprite/clone scripts or be the last in line to run?
The script you constructed in the video to sort layering was also really helpful as well. I'm working on a Scratch port/re-invention of the Monster Hunter game series in a top-down 2d environment (one I may post on this account) that I planned to use layering for to implement vertical attacks for both the player and monsters. While I'm yet to reach this stage of the game, I have been concerned on how I would implement an effective height system, especially with fluid layer changing that could collide and dislodge other layering. The straightforward and versatile solution you provided almost completely solved all of those problems.
My only fear is performance with the complexity I'm already aiming for and the fact that I'm running this on Turbowarp's interpolation (even though that compiles the code into a more efficient state, I'm still fearful). With the script, I am including terrain such as cliffs, trees, shrubs, etc. as clones rather than part of the core terrain feature/collision tiles once I convert from single tile maps. I don't mind reaching the clone limit, of course, since I'm going to design the game around Turbowarp. However, with my plan being geared towards interconnected maps rather than smaller, screen sized maps, I have my doubts that even Turbowarp could handle it with my limited testing of Turbowarp by running 5 Among Us games to cheat and win every time (don't question that). If you have any ideas about improving the efficiency of the layering script (both you, Griffpatch, and anyone else reading), I'd highly recommend advice.
I dont know why but a ton of scratch cats bouncing around the screen like the dvd logo was oddly hilarious to me
"I feel sorry for that chick."
**Proceeds to delete him from existence*
It's been years since I used scratch, but this video popped up and my feed and I clicked on it. Brings back memories and holy frick they completely revamped the UI
When He Said "The Fun Is Quite Endless" 27:28 I Was Like Majin Sonic LOL
4:11 best easter egg so far
10:19 I love when you do animations to explain how a script work 😸
@@X-tra_power yes he is strange 😂😂
@Angus1637 ????? 😂
4:08 made me appreciate Griffpatch's efforts even more in animating his videos to make it easier to understand.
@@spiritsk88 among us
Probably the only time Griffpatch used a sprite from the Scratch-Sprite Library! Great video griffpatch.
he used the apple asset in the pathfinding tutorial
"trees don't tend to walk around" - Griffpatch 2021
THIS IS PERFECT FOR A HIDE N SEEK GAME!
this is awesome! top down games are going to look so good thanks to this!
Wow! I am impressed with these best scratch tutorials! Can you also make a hard game from scratch? And keep Scratching!
Thank you so much griffpatch! I have a big game i was almost finished releasing the demo for and I kept putting off the layering of it. When i finally got around to it, It was a nightmare sorting everything and trying to get it to work properly, but this helped out a ton!
Can you do a learning ai next?
If you use lists to keep track of punishments and rewards I'm sure it's possible
Use cloud for the punishments
if we use cloud for punishments there will be an extremely long tangent on cloud lists
I love your videos griff! They are the best tutorials I’ve ever seen! (Also griffpatch, I’m not trying to beg, but we need more 3d raycater episodes!)
ive been searching through and analyzing every frame of this video trying to figure out where i went wrong but i literally cant find anything that isnt exactly how this tutorial showed it. it just doesnt work.
You found out yet?
@@Funni_Stuff buddy I don't even remember doing this or care by now it's been a YEAR.
I moved on from scratch and am good at unity by now brother.
@@idoblenderstuffs Nice job learning unity!
Same here, when I run the sorter in an infinite loop, my clones sometimes just go back and forth, which looks like flickering when they are layered on top of one another
This is seriously a thing we all need / needed at one point
It's Great! But, When I Click, Things are Just Starting to Get a Bit Lag...
This is just scratch... I'm afraid it's Scratch switching the editor from one sprite to another... It probably won't happen when the game is played with the editor closed before you look inside. Also, if you change the dragging code to use a keypress instead of the click then that solves the problem... it's not your fault.
@@griffpatch Really? But When I Followed the Coding Insertion Sort, And I Clicked It, and Cube: I Just Got Many Times, and Things Just Gets Lag. HELP.
4:50 Yay, finally we get to order some Sprites! I was getting thirsty!
Thank you for this! There aren't many advanced tutorials on scratches layering. I am making a top-down shooter game so layering is of the utmost importance. Unfortunately, I am not using this. I made my own layering system a while back that I'm using but this is great stuff!
When the scratch is sus. This is a really great tutorial. Among us in the background. How did you make the scratch cat's 3d at this part: 4:06? I also have camtasia.
I used the rotate feature on each layer, but had to move them manually in the X direction to make it look right.
i see a red bean with legs with a blue plate and a backpack
@@jasondevelopz that's an among us character
@@shng8528 and that’s what he was talking about
@@shng8528 ik its a joke
I like these tutorials because they are easy to understand even if complex I have watched a few tutorials because they are easy to learn
4:13 AMONG US
Bum BUM
pu Pu PU PU PU PU PUUU
Griffpatch makes me look forward to the start of the week : )
you put appel and lemons but now u put among us WHY AaAaAaAaAaAaAaAaAaAaAaAaAaAa
Yo what the actual ****ing sus thing you are talking
Omg!!! This is perfect for my game!!!!! 🤩🤩🤩 THANK YOU GRIFFPATCH!!!!! YOU'RE THE BEST!!!!!
Thank you so much Griffpatch! I needed sprite sorting for my new platformer and this has helped out a ton!
This just gave me an idea that you should make a advanced rpg/adventure game when you have time
you are the best teacher in the entire world
You are a excellent Coder
19:13 this is the first time that I have this trick so i'm excited 🔥
This is awesome 😲
so helpful, I made a 3d gravity simulation with this, thank you!
I needed this for so many of my projects, wish i knew this sooner.. it would’ve saved so many hours trying to get the layers perfect 😅
lol i had my own way of doing layering but your way is super efficient and much better. cool that you found a much easier way to do it
Very useful!
Would adding scrolling make this effect unusable?
Probably no
I don't get tired of saying this but all your tutorials are very useful
24:35 Everything is good until you notice the black dot in the top right of the stage
im not sure how efficient or if its even functional or applicable on scratch, but maybe it could be done with "go to back layer" and then "go forward (0 - (y position - 200)) layers" or something of that kind to sort in 2d? either way great video, learned a ton. cheers!
finally, i've been wanting this for a while
Griffpatch's Videos Are Awesome! Bro!
Awesome tutorial! Hope to put it to use some time soon...
Thanks Milan :)
Nano finally got a smile on his face! (This is his world, not that scary Raycaster!)
Thanks! This was really useful for my isometric Minecraft: Scratch Edition project I'm working on!
Wow sprite depth sorting! This will help me in many ways for creating 3d games!!
Griffpatch, you've definately succeeded with the visuals when you teach these tutorials.
Can you make a tutorial explainiing how to make snake, and also introducing grid lists with snake?
7:23 or just a suggestion you could have the sprites set a new variable to their y position, and compare if the order is bigger than 1, before setting the variable, comparing it to the previous position (stored in variable), and, if placed higher up, goes to back layer, on the flip side, going up 1 layer, because they run in layer order, therefore they can compare the variable to their own data edit: i didnt think of doing this because i didnt know they ran the broadcast code in layer order, however i did know they ran in seperately
Thanks Griffpatch! you're the best Scratcher!
Thank you! I'm using this for a sokoban game, as I want "floor" objects (like markings on the ground) to layer below everything else, but all the objects are clones in the same sprite
I'm having as much fun with this as you griffpatch! Thanks!
I'm going to use what I learned from this video to layer the towers and enemies in my tower defence project.
This is so useful to sort layers in projects, I was confusing to sort them in my projects that I'm just using the go to front layer blocks and it fianlly not working but this would just become so useful that you can just enter the layer in the block and it will sort it for you
Absolutely, so useful right
Thanks! This really helped me learn!
hi griffpatch can you make a tutorial titled how to make a cloud list pls
little question how do you get the number of clones and the position of each tings next to the green flags?
Yes! Great video Griffpatch!
And of course - chickens for the win. That got me.
This is literally what I needed
Thank you so much ! You helped the beginning of my project
Griffpatch, you are a genius!
griffpatch back at it with the banger videos
Thanks, this was useful! Also you’re so close to 100k! You can do this, you’ll be able to get the silver creator awards and get verified! 😃
Yeah, amazing right!
This is exactly what I was looking for
4:12 damm bro griffpatch be a lil humorous
I was making an rpg style game, this is just what it needed thank you griffpatch!
I actually really need this for a game I was working on! Thank you so much!
This video will be outstandingly essential to one of my game ideas.
(And it's given me another idea, too.)
I love your videos Griffpatch. Amazing job. Your tutorials have taught me so many things! One question: What do you use to record your videos?
There's a link to my editor under the video :)
Awsome!! This Is Very Useful Thanks!!
4:11 Nice video! I love how the little red Among Us character is peeking out the edge. Red sus
wow thank you! i needed this for my multiplayer game!
That was a great tutorial. :)
Glad you liked it :)
AMOGUS AT 4:11 !, sneaky griffpatch
This is really useful, I've always wanted this. (also I saw something sus at 4:13 )
really usefull! definatly gonna rtemember this haha
Hi Griffpatch! Would it be ok for you when you make a tutorial for projects like that Fibonacci Sphere? It would be cool 😀😁
Hey griffpatch! I have found a way to make it instant, you dont want that cat appearing out of nowhere? Use blocks! Make a block called clone or somthing else, attach it to under the set size to 150 block but remember to take out the blocks below the set size to 150 first then put the block, now put the blocks you just pulled out of, and attach it to the define, not that the block MUST BE WITHOUT SCREEN REFRESH yet it makes a istant meaning instant layering! Now you wont have to need to wait
almost 100k! playbutton soon
Bro this is awesome! I can’t wait for the next o- *wait it’s not monday*
Griffpatch, I love your videos! Keep going! Also, I'm wondering if you are doing a Q&A. If you are, great!
4:13 sus amogus XD
By the way, Great video as always!
18:05 Haha thank you griffpatch ❤️✨