Perfect Sprite Ordering in Scratch 🐱 | Backpack Depth Sort Tutorial

Поділитися
Вставка
  • Опубліковано 24 лис 2024

КОМЕНТАРІ • 1,3 тис.

  • @Amechaniaa
    @Amechaniaa 3 роки тому +170

    Why not use a more efficient sorting algorithm?

    • @griffpatch
      @griffpatch  3 роки тому +88

      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.

    • @hriday684
      @hriday684 3 роки тому +20

      @@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.

    • @dooplerpoopler
      @dooplerpoopler 3 роки тому +5

      @@griffpatch sussy mogus (O3 sus lol

    • @griffpatch
      @griffpatch  3 роки тому +13

      @@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

    • @Getoutpl33se
      @Getoutpl33se 3 роки тому +3

      @@hriday684 say contextual but replace conte with se and remove the 2nd t”t”

  • @hakkerkat
    @hakkerkat 3 роки тому +291

    I like griffpatch's tutorials because you actually understand them. Unlike the other ones, where you just copy everything.

    • @tankyd8229
      @tankyd8229 3 роки тому +22

      Agreed

    • @MrPork-he5lz
      @MrPork-he5lz 3 роки тому +10

      @@tankyd8229 True

    • @Supyisiscool
      @Supyisiscool 3 роки тому +9

      @@MrPork-he5lz very true

    • @didiervandendaele4036
      @didiervandendaele4036 3 роки тому +16

      @@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 !

    • @lincekawaiilindi5422
      @lincekawaiilindi5422 3 роки тому +5

      I agree

  • @spiritsk88
    @spiritsk88 3 роки тому +45

    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!

  • @yusong6729
    @yusong6729 3 роки тому +22

    This is great! My money was worth it to see these tutorials early! Nice Griffpatch!

    • @TirzaBoi
      @TirzaBoi 3 роки тому +2

      8 hours ago?!?! This was posted 2 minutes ago.

    • @MrPuzzleCodes
      @MrPuzzleCodes 3 роки тому +4

      @@TirzaBoi thy can see the video early cause of their subscription

    • @TirzaBoi
      @TirzaBoi 3 роки тому +2

      @@MrPuzzleCodes oh yeah i forgor ☠️

  • @blueboytube
    @blueboytube 10 місяців тому +2

    This is one of the best tutorials on the entirety of UA-cam

  • @RealKipper1324
    @RealKipper1324 3 роки тому +12

    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!

  • @maplario4366
    @maplario4366 3 роки тому +11

    “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.

  • @link8893
    @link8893 Рік тому +3

    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.

  • @improvisestudios
    @improvisestudios 3 роки тому +9

    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!

  • @ElmoGorilla
    @ElmoGorilla 2 роки тому +9

    The great thing with griffpatch's tutorials is that they are easy to learn unlike other people who put in as much as possible.

  • @InverseOfficial
    @InverseOfficial 3 роки тому +10

    The edits during this video look really neat and make this super easy to understand! Great video as always.

  • @lukeninja032
    @lukeninja032 3 роки тому +15

    I literally trying every single video, keep it up Griffpatch, your tutorials are so helpful

  • @NeekBot5000
    @NeekBot5000 3 роки тому +2

    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.

  • @totallyapinetree
    @totallyapinetree 3 роки тому +6

    THANK YOU SO MUCH FOR THIS! This is the most useful tutorial I’ve ever watched in all of tutorials ever!!

  • @LupinGrossman
    @LupinGrossman 5 місяців тому +3

    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?

  • @thunder-hedge
    @thunder-hedge 3 роки тому +26

    This is actually very useful, thanks Griffpatch.

  • @vii-ka
    @vii-ka 2 роки тому +2

    i made the 1000th comment so that hopefully this video will get recommended to more people it's such a good tutorial

  • @SLSmartMind
    @SLSmartMind 3 роки тому +8

    04:12 AMONG US.
    AWESOME TUTORIAL 😄

  • @roggeralves94
    @roggeralves94 10 місяців тому

    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!

  • @DexFire1115
    @DexFire1115 2 роки тому +6

    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.

  • @qwertyuiop.lkjhgfdsa
    @qwertyuiop.lkjhgfdsa 2 роки тому +2

    I dont know why but a ton of scratch cats bouncing around the screen like the dvd logo was oddly hilarious to me

  • @ninjinity6684
    @ninjinity6684 3 роки тому +12

    "I feel sorry for that chick."
    **Proceeds to delete him from existence*

  • @bungsbodulus
    @bungsbodulus 3 роки тому

    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

  • @janraymond5190
    @janraymond5190 3 роки тому +3

    When He Said "The Fun Is Quite Endless" 27:28 I Was Like Majin Sonic LOL

  • @ventisstuff
    @ventisstuff 3 роки тому +2

    4:11 best easter egg so far

  • @FeniteFr
    @FeniteFr 3 роки тому +9

    10:19 I love when you do animations to explain how a script work 😸

    • @FeniteFr
      @FeniteFr 3 роки тому +2

      @@X-tra_power yes he is strange 😂😂

    • @FeniteFr
      @FeniteFr 3 роки тому +2

      @Angus1637 ????? 😂

    • @spiritsk88
      @spiritsk88 3 роки тому +1

      4:08 made me appreciate Griffpatch's efforts even more in animating his videos to make it easier to understand.

    • @simplylou8631
      @simplylou8631 2 роки тому

      @@spiritsk88 among us

  • @bigbricks1003
    @bigbricks1003 3 роки тому +2

    Probably the only time Griffpatch used a sprite from the Scratch-Sprite Library! Great video griffpatch.

    • @cheesepop7175
      @cheesepop7175 2 роки тому

      he used the apple asset in the pathfinding tutorial

  • @problem7952
    @problem7952 3 роки тому +6

    "trees don't tend to walk around" - Griffpatch 2021

  • @freddyfazbear3195
    @freddyfazbear3195 2 роки тому +1

    THIS IS PERFECT FOR A HIDE N SEEK GAME!

  • @dazcarrr
    @dazcarrr 3 роки тому +6

    this is awesome! top down games are going to look so good thanks to this!

  • @origamiplay1141
    @origamiplay1141 3 роки тому +4

    Wow! I am impressed with these best scratch tutorials! Can you also make a hard game from scratch? And keep Scratching!

  • @sirblueberrous146
    @sirblueberrous146 10 місяців тому

    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!

  • @Super-qr7wm
    @Super-qr7wm 3 роки тому +7

    Can you do a learning ai next?
    If you use lists to keep track of punishments and rewards I'm sure it's possible

    • @m0nt0p23
      @m0nt0p23 2 роки тому

      Use cloud for the punishments

    • @3FourFour5
      @3FourFour5 2 роки тому

      if we use cloud for punishments there will be an extremely long tangent on cloud lists

  • @IkeIllich
    @IkeIllich Місяць тому

    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!)

  • @idoblenderstuffs
    @idoblenderstuffs 2 роки тому +3

    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.

    • @Funni_Stuff
      @Funni_Stuff 6 місяців тому +1

      You found out yet?

    • @idoblenderstuffs
      @idoblenderstuffs 6 місяців тому +2

      @@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.

    • @Funni_Stuff
      @Funni_Stuff 6 місяців тому +1

      ​@@idoblenderstuffs Nice job learning unity!

    • @Alex-is-Procrastinating
      @Alex-is-Procrastinating Місяць тому +1

      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

  • @spoopyissad
    @spoopyissad 3 роки тому

    This is seriously a thing we all need / needed at one point

  • @Septagon_Sep
    @Septagon_Sep 3 роки тому +8

    It's Great! But, When I Click, Things are Just Starting to Get a Bit Lag...

    • @griffpatch
      @griffpatch  3 роки тому +4

      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.

    • @Septagon_Sep
      @Septagon_Sep 3 роки тому

      @@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.

  • @TtEL
    @TtEL 3 роки тому +2

    4:50 Yay, finally we get to order some Sprites! I was getting thirsty!

  • @tdub1776
    @tdub1776 3 роки тому +2

    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!

  • @creepersaur
    @creepersaur 3 роки тому +16

    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.

    • @griffpatch
      @griffpatch  3 роки тому +4

      I used the rotate feature on each layer, but had to move them manually in the X direction to make it look right.

    • @jasondevelopz
      @jasondevelopz 3 роки тому +3

      i see a red bean with legs with a blue plate and a backpack

    • @shng8528
      @shng8528 3 роки тому +2

      @@jasondevelopz that's an among us character

    • @nikothenoob
      @nikothenoob 3 роки тому

      @@shng8528 and that’s what he was talking about

    • @jasondevelopz
      @jasondevelopz 3 роки тому +1

      @@shng8528 ik its a joke

  • @cjgamesstudios3289
    @cjgamesstudios3289 2 роки тому +1

    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

  • @Blue-gy2it
    @Blue-gy2it 3 роки тому +4

    4:13 AMONG US

  • @Sharp2006
    @Sharp2006 3 роки тому +1

    Griffpatch makes me look forward to the start of the week : )

  • @oscarhuang8732
    @oscarhuang8732 2 роки тому +4

    you put appel and lemons but now u put among us WHY AaAaAaAaAaAaAaAaAaAaAaAaAaAa

  • @megatron4507
    @megatron4507 2 роки тому +1

    Omg!!! This is perfect for my game!!!!! 🤩🤩🤩 THANK YOU GRIFFPATCH!!!!! YOU'RE THE BEST!!!!!

  • @SamFromSpaceOfficial
    @SamFromSpaceOfficial 3 роки тому +1

    Thank you so much Griffpatch! I needed sprite sorting for my new platformer and this has helped out a ton!

  • @kaustubhshrestha1265
    @kaustubhshrestha1265 3 роки тому +1

    This just gave me an idea that you should make a advanced rpg/adventure game when you have time

  • @-epicool-
    @-epicool- 3 роки тому +1

    you are the best teacher in the entire world

  • @ZaniSquad
    @ZaniSquad 3 роки тому +1

    You are a excellent Coder

  • @FeniteFr
    @FeniteFr 3 роки тому +2

    19:13 this is the first time that I have this trick so i'm excited 🔥
    This is awesome 😲

  • @jazzling
    @jazzling 2 роки тому +1

    so helpful, I made a 3d gravity simulation with this, thank you!

  • @Damageer
    @Damageer 3 роки тому +2

    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 😅

  • @DylanTheEye
    @DylanTheEye 2 роки тому

    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

  • @KnitnStyle432
    @KnitnStyle432 Рік тому +1

    Very useful!

  • @_-cyber_
    @_-cyber_ 2 роки тому +2

    Would adding scrolling make this effect unusable?

  • @grandestag
    @grandestag 3 роки тому

    I don't get tired of saying this but all your tutorials are very useful

  • @Speed-TV
    @Speed-TV 2 роки тому +1

    24:35 Everything is good until you notice the black dot in the top right of the stage

  • @emilyy03
    @emilyy03 3 роки тому +1

    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!

  • @beehivemind9343
    @beehivemind9343 3 роки тому

    finally, i've been wanting this for a while

  • @AshSomera
    @AshSomera Рік тому

    Griffpatch's Videos Are Awesome! Bro!

  • @milankarow6567
    @milankarow6567 3 роки тому +2

    Awesome tutorial! Hope to put it to use some time soon...

  • @CBFNetworksArchive
    @CBFNetworksArchive Рік тому

    Nano finally got a smile on his face! (This is his world, not that scary Raycaster!)

  • @easylemon6640
    @easylemon6640 Рік тому

    Thanks! This was really useful for my isometric Minecraft: Scratch Edition project I'm working on!

  • @gunjantutorial7405
    @gunjantutorial7405 3 роки тому

    Wow sprite depth sorting! This will help me in many ways for creating 3d games!!

  • @HormaV5
    @HormaV5 3 роки тому

    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?

  • @MINTGREENYT369
    @MINTGREENYT369 2 роки тому +1

    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

  • @supersmashbrosforscratch8762
    @supersmashbrosforscratch8762 2 роки тому

    Thanks Griffpatch! you're the best Scratcher!

  • @theopoldthegamer4284
    @theopoldthegamer4284 6 місяців тому

    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

  • @ninan-9196
    @ninan-9196 3 роки тому

    I'm having as much fun with this as you griffpatch! Thanks!

  • @brandonseupersad7916
    @brandonseupersad7916 3 роки тому

    I'm going to use what I learned from this video to layer the towers and enemies in my tower defence project.

  • @double9videos
    @double9videos 2 роки тому

    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

    • @griffpatch
      @griffpatch  2 роки тому

      Absolutely, so useful right

  • @bluedragooo
    @bluedragooo Рік тому +1

    Thanks! This really helped me learn!

  • @hussin_-ws7bc
    @hussin_-ws7bc 3 роки тому +1

    hi griffpatch can you make a tutorial titled how to make a cloud list pls

  • @draconia-shadow
    @draconia-shadow 3 роки тому +1

    little question how do you get the number of clones and the position of each tings next to the green flags?

  • @jameswoodcock485
    @jameswoodcock485 3 роки тому

    Yes! Great video Griffpatch!
    And of course - chickens for the win. That got me.

  • @tezereth
    @tezereth 3 роки тому

    This is literally what I needed

  • @ChocolatBs
    @ChocolatBs 2 роки тому

    Thank you so much ! You helped the beginning of my project

  • @impressivesmirk
    @impressivesmirk Рік тому

    Griffpatch, you are a genius!

  • @Taelo
    @Taelo 3 роки тому

    griffpatch back at it with the banger videos

  • @LilyPillow
    @LilyPillow 3 роки тому +2

    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! 😃

  • @archusrtm6325
    @archusrtm6325 3 роки тому

    This is exactly what I was looking for

  • @dunnomynameso746
    @dunnomynameso746 2 роки тому +1

    4:12 damm bro griffpatch be a lil humorous

  • @WorstedCorgi90
    @WorstedCorgi90 3 роки тому

    I was making an rpg style game, this is just what it needed thank you griffpatch!

  • @Opti234
    @Opti234 3 роки тому

    I actually really need this for a game I was working on! Thank you so much!

  • @yannismorris4772
    @yannismorris4772 3 роки тому

    This video will be outstandingly essential to one of my game ideas.
    (And it's given me another idea, too.)

  • @saanvimurali6a054
    @saanvimurali6a054 3 роки тому +1

    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?

    • @griffpatch
      @griffpatch  3 роки тому +1

      There's a link to my editor under the video :)

  • @sheryvp1
    @sheryvp1 3 роки тому +1

    Awsome!! This Is Very Useful Thanks!!

  • @blenderfox_foxwastaken
    @blenderfox_foxwastaken 2 роки тому

    4:11 Nice video! I love how the little red Among Us character is peeking out the edge. Red sus

  • @zippycat
    @zippycat 2 роки тому

    wow thank you! i needed this for my multiplayer game!

  • @Twin138956Productions2019
    @Twin138956Productions2019 3 роки тому +1

    That was a great tutorial. :)

  • @igglywigglyw0rm
    @igglywigglyw0rm Рік тому

    AMOGUS AT 4:11 !, sneaky griffpatch

  • @thetitantacos7126
    @thetitantacos7126 3 роки тому +1

    This is really useful, I've always wanted this. (also I saw something sus at 4:13 )

  • @haywiressc2608
    @haywiressc2608 3 роки тому +1

    really usefull! definatly gonna rtemember this haha

  • @derwastl
    @derwastl 2 роки тому +2

    Hi Griffpatch! Would it be ok for you when you make a tutorial for projects like that Fibonacci Sphere? It would be cool 😀😁

  • @ellayin0406
    @ellayin0406 Рік тому

    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

  • @zwlw
    @zwlw 3 роки тому +1

    almost 100k! playbutton soon

  • @ExtemTheHedgehogLol
    @ExtemTheHedgehogLol 3 роки тому

    Bro this is awesome! I can’t wait for the next o- *wait it’s not monday*

  • @FunkyPupo
    @FunkyPupo 2 роки тому

    Griffpatch, I love your videos! Keep going! Also, I'm wondering if you are doing a Q&A. If you are, great!

  • @gameoflogic8136
    @gameoflogic8136 3 роки тому +1

    4:13 sus amogus XD
    By the way, Great video as always!

  • @FeniteFr
    @FeniteFr 3 роки тому +1

    18:05 Haha thank you griffpatch ❤️✨