BEST Way To Animate In Scratch

SdĂ­let
VloĆŸit
  • čas pƙidĂĄn 21. 03. 2022
  • In today's Scratch tutorial, I show the BEST way I know how to animate with code. More specifically, I show how to switch the costumes so that they animate smoothly and without delay.
    Let's get coding!
    Thanks for watching! Please hit the like button and subscribe for future Scratch tutorials!
    🔗 LINKS:
    ▶ Scratch Profile Page:
    scratch.mit.edu/users/ShiftCl...
    ▶ All Videos In This Series:
    ‱ Scratch 2 Player Tank ...
    ▶ ShiftClickLearn Community:
    ‱ SCL Scratch Community
    ▶ Scrolling Platformer (Night Ninja):
    ‱ Scratch | Scrolling Pl...
    ▶ Cat Clicker tutorial:
    ‱ Scratch | Cat Clicker ...
    ▶ Crossy Road tutorial:
    ‱ Scratch | Making a Cro...
    ▶ Tower Defense tutorial:
    ‱ Scratch | Making a Tow...
    ▶ Fish Game tutorial:
    ‱ Scratch Tutorial | Hun...
    ▶ Scrolling Platformer tutorial:
    ‱ Scratch Tutorial | Eas...
    ▶ Combat Based Platformer tutorial:
    ‱ Scratch | Making a Com...
    ▶ Space Shooter game tutorial:
    ‱ Scratch Space Shooter ...
    ▶ How-to tutorials:
    ‱ Scratch | How-To Tutor...
    😾 Get Scratch Addons:
    scratchaddons.com/
    ❗ DISCLAIMER: This video is family-friendly! Hostile and/or rude comments will not be tolerated!

Komentáƙe • 293

  • @ShiftClickLearn
    @ShiftClickLearn  Pƙed 2 lety +56

    Hi everyone! I hope this tutorial helped you out animating your characters! :D

  • @nathanruhstofer830
    @nathanruhstofer830 Pƙed rokem +22

    You know.... I've always followed tutorials but never understood why they put the blocks here or there, but you explained how it worked and I was finally able to understand! Thanks a lot!!

  • @jeffreygordon7194
    @jeffreygordon7194 Pƙed 2 lety +6

    Great job on this. These short explanation videos that focus on a single key concept really stand out among scratch tutorials on CZcams.

  • @austencope
    @austencope Pƙed 2 lety +41

    Thank you so much for this! I was trying to make a script that makes the animation play at different speeds, and this is exactly what I was looking for!

  • @minhkhoiphungtran6759
    @minhkhoiphungtran6759 Pƙed rokem

    Thanks man i was actually struggling on the loop problem and once i'm about to quit i came by ur video. Keep it up!

  • @JustMe...12354
    @JustMe...12354 Pƙed rokem +1

    I should've looked up a video about this sooner, It would've saved me SOOOO much time. THANK YOU!!!

  • @JoshuaDixon-n9x
    @JoshuaDixon-n9x Pƙed 6 dny +1

    TYSM! I always wanted to learn how to animate a character in a game and now thanks to you I can.

  • @Rory432
    @Rory432 Pƙed 2 lety +4

    Nice! I’m definitely going to show this to the guys down at my animation club!

  • @user-zr5fb5bq2t
    @user-zr5fb5bq2t Pƙed 4 měsĂ­ci

    this tutorial is actually the best animation i've ever seen. im doing this on a laptop and there's NO LAG.

  • @BestBoi8
    @BestBoi8 Pƙed 8 měsĂ­ci +3

    For anyone who wants the time until the frame swaps to be consistent (not switching to walk anim1 and instantly switching to walk anim2) You can reset the _costume variable when your "if moving" variable updates (this worked for me but idk if it works perfectly in the tutorials exact code since mine is slightly different)

  • @IceBit0
    @IceBit0 Pƙed 2 měsĂ­ci

    Bro has no idea how much he helped me. I got 23rd place in a game jam for kids (scratch only) , everyone's animations were choppy but mine weren't thanks to this guy :)

  • @Geezi24
    @Geezi24 Pƙed 2 lety +5

    Congrats on 9k dude! You definetly deserve it! 💯💯

  • @user-ke4uk5ot4w
    @user-ke4uk5ot4w Pƙed 8 měsĂ­ci +1

    Thank you so much for this video!!!You help me to complete a animation on scratch

  • @ZachariahKylePieterse
    @ZachariahKylePieterse Pƙed měsĂ­cem

    Loved this, helped a lot with my game.

  • @HollowM0th
    @HollowM0th Pƙed rokem

    Is rain world-like procedural animation possible in scratch? I’ve been trying to make it and I have a green lizard’s body and head but whenever I try to make the head turn at a higher speed than the body, it gets disconnected. It still disconnects if it suddenly has to change direction. The back and front of the body can move at different speeds and be fine though.

  • @Wallee580
    @Wallee580 Pƙed 2 lety +7

    Hello Owen!
    Can't wait to you reach 10K subs :p

    • @nikolangot
      @nikolangot Pƙed 2 lety +3

      who is owen?

    • @Wallee580
      @Wallee580 Pƙed 2 lety +2

      @@nikolangot Owen is ShiftClickLearn's actual name, you don't think his birth certificate has his channels name on it do you? :p

    • @ShiftClickLearn
      @ShiftClickLearn  Pƙed 2 lety +3

      Hiya! I can't either!

  • @paperjoe
    @paperjoe Pƙed 2 lety +1

    Thanks! I was trying for 1 week to do this by myself and i couldn't do it. Subscribed!

  • @Crazybros0
    @Crazybros0 Pƙed 2 lety +2

    thank you so much!! ive been trying to make good animations for my new game but have always had problems with the delays. now i can have good animations :D

  • @shirigayamahiro6273
    @shirigayamahiro6273 Pƙed měsĂ­cem

    Thanks a lot. Im saved from depression wasted a lot of hours trying to find a way to do this. Scratch really have a confusing way to animate costume when you are a beginner. I can't use things like while, released, and some operators. Many in youtube just using 2 costume way which they just use like in The video where its not a fricking chance where I have like 20 frames for running, 30 frames for jumping and etc, it will waste a lot of space and time,even if we disregard that its also not looking smoothly. So yeah thanks a lot

  • @kylierodriguez7617
    @kylierodriguez7617 Pƙed rokem +1

    THANK YOU SO MUCHHHHHH I NEEDED THISSS

  • @ShrekCOVEY
    @ShrekCOVEY Pƙed rokem

    Thank you for this! I need to animate a cartoon for my class.

  • @davidakenji4746
    @davidakenji4746 Pƙed 6 měsĂ­ci

    i used your video on hitboxes and tried to combine it with this one but the programs don’t seem to be working properly because i’m getting no animation at all. what would be the problem?

  • @gravesilk322
    @gravesilk322 Pƙed rokem +1

    How r u so underrated??? Your tutorials are so easy to follow and you are rlly funny aswell!!!

  • @therealgookie
    @therealgookie Pƙed 8 měsĂ­ci

    If im trying to make a full on animation, is there any way to recreate tweens and frame transitions?

  • @tommax1626
    @tommax1626 Pƙed rokem

    Hey there, i want to create clones with many animations playing at once, how much can scratch handle before being slowed down?
    ?

  • @shirou636
    @shirou636 Pƙed rokem +1

    how do i add a i downloaded to my soft soft so i can resetup it?

  • @pinewaresoftware4247
    @pinewaresoftware4247 Pƙed 5 měsĂ­ci

    thank you thats the third time i needed this video

  • @Titi-tf5uy
    @Titi-tf5uy Pƙed rokem +1

    I tried this and the idle worked amazing! but the walking doesn't seem to work. When i press d or a only one of the costumes play and not the entire walk cycle. Do you know how to fix this?

  • @kostasismename9493
    @kostasismename9493 Pƙed rokem +4

    you can use the round block to fit the entire animation in 1 single line (also you can use timer instead of a variable, which reduces file size by not alot but i thought i'd say that)

    • @Nightgames_YT_949
      @Nightgames_YT_949 Pƙed měsĂ­cem

      You wanna know what im planning on?

    • @kostasismename9493
      @kostasismename9493 Pƙed měsĂ­cem

      @@Nightgames_YT_949 ...sure

    • @Nightgames_YT_949
      @Nightgames_YT_949 Pƙed měsĂ­cem

      @@kostasismename9493 Im planning on to make a Fanmade Murder drone movie.With good ending.

  • @shahinma221
    @shahinma221 Pƙed 2 lety +2

    Me when @ShiftClickLearn uploads a video : YAYAYAYAYAYAYAYAYAYAYAYAYAYAYAYAYAYA(happiness)

  • @geodelire
    @geodelire Pƙed 2 lety +2

    Honestly you deserve 100k subs btw i was here when you had 3k

  • @SputerTheHorse
    @SputerTheHorse Pƙed rokem +2

    I usually use “When space clicked next costume” and there’s usually one sprite and I consider the costumes as “Frames” (My animations are usually simple and I copy and paste from other sprites)

  • @akjstuff6980
    @akjstuff6980 Pƙed rokem

    @ShiftClickLearn hey is there a way to play different animations like a jump into a idle if there is can you respond

  • @tolonmalabekov2684
    @tolonmalabekov2684 Pƙed 2 lety +4

    COOOOOOOOOOOOOOOOOOOOOOOOOOOOL TUTORIALS !!!!!!!!!

  • @Nathaniel-Ledgister
    @Nathaniel-Ledgister Pƙed rokem

    tysm, i remebered i had to use a mod block but not sure where you help me so much

  • @BluePigeonRando
    @BluePigeonRando Pƙed 12 dny

    How do I make it so when it exits the screen it comes back through the other side

  • @johandraws3166
    @johandraws3166 Pƙed rokem +1

    Thank you SO MUCH, I needed this

  • @rlawrence678
    @rlawrence678 Pƙed 2 lety +2

    I'll use these tips

  • @noahlurvink
    @noahlurvink Pƙed rokem

    Hello, for me when i start walking around it also plays the idle animation while im walking.. Also, could you make something on how to make a jumping animation with multiple costumes? Thanks :)

  • @kaytchouate1342
    @kaytchouate1342 Pƙed rokem

    thanks
    you don not know how much i wanted to do this :)

  • @bigman8085
    @bigman8085 Pƙed 2 lety +3

    Thank you so much for this tutorial

  • @We_can_change_the_world
    @We_can_change_the_world Pƙed 8 měsĂ­ci

    Thanks you're the best you just gained a follower

  • @cosmo4q538
    @cosmo4q538 Pƙed 2 lety +3

    Yes

  • @SIG7Pro
    @SIG7Pro Pƙed 2 lety +2

    Nice! I might use this one day!

  • @acyssfx
    @acyssfx Pƙed 3 měsĂ­ci

    Hi, nice trick. I am very new to Scratch, quick question. Will the variable eventually reach it's max value? Like in c#, an INTEGER has a max value of 32k or something. What are the variables treated as in scratch? I assume some kind of float or double if they use decimal points. Is there a max/min value of variables?

  • @aidenakpan3213
    @aidenakpan3213 Pƙed měsĂ­cem

    how would I do this with more complicated animations?

  • @j786friend4
    @j786friend4 Pƙed 2 měsĂ­ci

    Thanks for the help.

  • @cakesrus3852
    @cakesrus3852 Pƙed 2 lety +2

    Awesome this is way to cool !!!

  • @CMichaelNeely
    @CMichaelNeely Pƙed 2 lety +2

    I love animations.

  • @thingwithahoodie
    @thingwithahoodie Pƙed rokem

    is there a way to do this wiith animations

  • @odohjn
    @odohjn Pƙed 8 měsĂ­ci

    incredibly helpful, you deserve a sub!

  • @AnArcadeMan
    @AnArcadeMan Pƙed 2 lety +3

    Hey ShiftClick can you do a tutorial on how to make the google Scoville game. and i loved the viedo

    • @ShiftClickLearn
      @ShiftClickLearn  Pƙed 2 lety +2

      I haven't played that game. I will have to check it out!

  • @jacksonvandenheever8241
    @jacksonvandenheever8241 Pƙed měsĂ­cem

    for some reason the costume value SHOOTS into the ten-thousands in a second even though i have the exact code as u?! please help, is it the softwares issue?

  • @hafizsabiqulhaq6041
    @hafizsabiqulhaq6041 Pƙed 11 měsĂ­ci

    This is helped me. Thanks

  • @Hamgotnew
    @Hamgotnew Pƙed 11 měsĂ­ci

    i spend 20 mins trying to fix it and i just had to this video!!

  • @Sushi37
    @Sushi37 Pƙed 5 měsĂ­ci

    How can you make it so you can use W and S?

  • @patotatoman455
    @patotatoman455 Pƙed rokem +7

    It's a great video, and it had helped me a lot. However, I have a question. I'm doing a fighting game, and for animations like Idle and walking this is very useful, however, when i'm trying to do a punch, how do you make that an animation runs just 1 time without using waits? Is it possible, or it's just better to use the old method (with waits and stuff)

  • @RecraftedS
    @RecraftedS Pƙed 2 lety +2

    Thank You! This is So Useful!!! :D

  • @AlexisTorresLozada
    @AlexisTorresLozada Pƙed 9 měsĂ­ci

    What are all the variables for because I am confuse

  • @brsquadscratchr
    @brsquadscratchr Pƙed rokem

    ShiftClickLearn is a legend

  • @jorgeanthoniohuertavazquez714

    yo bro, really thankya. Big respect

  • @corndogthehedgehog277
    @corndogthehedgehog277 Pƙed 2 lety +1

    Thanks at the first part of the vid when i did all of your code it was laggy but when i finished not anymore!

  • @thepers0nwh0asked
    @thepers0nwh0asked Pƙed rokem

    pretty late to the party but thank you sooo soo much im making a top view tower defense game and this really helped thank you!

  • @faheemrehman5889
    @faheemrehman5889 Pƙed 11 měsĂ­ci

    Thx this really helped

  • @JustPlay817
    @JustPlay817 Pƙed 3 měsĂ­ci +1

    So cool!

  • @Dolliestxo
    @Dolliestxo Pƙed rokem

    tysm this works so well but one thing i need is a running animation 😭😭

  • @bennie1079
    @bennie1079 Pƙed rokem +1

    Is it really not possible to import a premade video directly into the code?
    Like some sort of "play animation" or "play video" that just plays the video you importeted?
    Does everything HAVE to be frame by frame?

    • @matuchuru
      @matuchuru Pƙed 8 měsĂ­ci

      yep
      3 months later

  • @FLoriN2
    @FLoriN2 Pƙed 2 lety +2

    Nice script, thanks!

  • @Lucas_Lowder
    @Lucas_Lowder Pƙed 9 měsĂ­ci

    How do i make it go up?

  • @ppoly
    @ppoly Pƙed rokem +1

    hey so, i'm having a bit of trouble.
    what's going on is that i want an animation that lasts for 3 frames, then goes to an idle animation for 1 second
    the problem is that i can't find a way to make it work
    any help appreciated thank you

    • @ShiftClickLearn
      @ShiftClickLearn  Pƙed rokem

      Hmm, try making a time that constantly ticks down. Then once it equals a certain value, reset it. Ex:
      when green flag clicked {
      set timer to 33;
      }
      forever {
      if (timer > 30) {
      play the animation that lasts for 3 frames
      }
      else {
      play the one that last for 1 second.
      }
      change timer by -1
      if (timer < 1) {
      set timer to 33
      }
      }
      I don't know if this will work for sure, but it should. Basically each frame it will check if the timer var is equal to 30, 31, or 32, and if it is, switch costume to the 3 frame animation. Other wise, it will play the 1 second animation 30 times. (Scratch runs at 30fps so it should run the forever loop 30 times a second.) Then once the timer reaches 0, it will start over.

    • @ppoly
      @ppoly Pƙed rokem

      @@ShiftClickLearn did that, the thing is completely static now.

  • @mixrockbonnie1073
    @mixrockbonnie1073 Pƙed 27 dny

    Thanks a lot for this tutorial, the only problem is that on the 4 keys (arrrow keys) one's animation doesn't work

  • @Rora2
    @Rora2 Pƙed 2 lety +1

    How do i do this if i set up my movement and collisions with your other tutorial for collisions?

    • @ShiftClickLearn
      @ShiftClickLearn  Pƙed 2 lety

      You would make a platformer, then just add this animation code in a loop. (A forever loop or a when I receive loop.)

  • @ImKarmaHQ
    @ImKarmaHQ Pƙed 6 měsĂ­ci

    I used this to make a custom block that does the switching and stuff and stuff.

  • @arjundas2434
    @arjundas2434 Pƙed rokem

    This guy is a legend

  • @koneenika1324
    @koneenika1324 Pƙed rokem +2

    Hi! What would you do to make it so that the idle animation faces the same way when the character moves a certain direction and stops? Thank you sooo much for this video it was very helpful :)

    • @viccalyn28_26
      @viccalyn28_26 Pƙed rokem

      you remove the "POINT IN DIRECTION Ximput x 90"

  • @Noc.3ds
    @Noc.3ds Pƙed rokem +1

    You are the Best! Thank you so much! 🙌

  • @moosvfx
    @moosvfx Pƙed rokem +1

    i really apreciate your help with dowloanding this software

  • @theorangecat1244
    @theorangecat1244 Pƙed 2 lety +2

    thank you!

  • @annaritacapellupo5797
    @annaritacapellupo5797 Pƙed rokem +1

    working fine thank you

  • @mateuszpatua3016
    @mateuszpatua3016 Pƙed rokem

    brilliant!

  • @daiddd11
    @daiddd11 Pƙed rokem

    Thanks u too much. U help me a lot.

  • @Nayrlol6855
    @Nayrlol6855 Pƙed 2 lety +1

    For people with the scratch addons addon i sugegs you do change costume to say broadcast 1 change costume to say broadcast 2 then right click anywhere click clean up blocks+

  • @anamoyeee
    @anamoyeee Pƙed 2 lety +2

    Nice video!

  • @nsksisk
    @nsksisk Pƙed 3 měsĂ­ci

    how do i make this work in mobile?

  • @splatzer8240
    @splatzer8240 Pƙed rokem +1

    Question: For the idle animation, how to you make the frame for example, go to 1-5 than go backwards, if that makes sense.

    • @ShiftClickLearn
      @ShiftClickLearn  Pƙed rokem

      Hmm, try repeating the amount of costumes in the animation, change the _costume var by a positive number, then repeating the amount of costumes in the animation again, changing it by a negative number. Ex:
      repeat 5 {
      change _costume by 0.5
      }
      repeat 5 {
      change _costume by -0.5
      }
      I think this will work. :D

    • @splatzer8240
      @splatzer8240 Pƙed rokem

      @@ShiftClickLearn Its okay I found another way! But thanks for your help, sounds more effective than back a dupe of the costumeXD.

  • @captainblues1
    @captainblues1 Pƙed 2 lety +2

    That's genius, mate!

  • @Fidion
    @Fidion Pƙed 14 dny

    Ty!!

  • @stupid40266
    @stupid40266 Pƙed 27 dny

    I have a problem where I cannot animate x and y directions at the same time

  • @iceycool5156
    @iceycool5156 Pƙed rokem

    how to make this go up and down?

  • @silverseyeris
    @silverseyeris Pƙed 2 lety +1

    I'm trying to do the animation for up and down currently, but the up animation for some reason does both the left and right animation aswell
    how do i fix this?

    • @ShiftClickLearn
      @ShiftClickLearn  Pƙed 2 lety +1

      Well, it's really hard to tell without seeing the code... Did you put the right conditions in the if loops that check what animation should play?

    • @silverseyeris
      @silverseyeris Pƙed 2 lety

      @@ShiftClickLearn yup!

    • @silverseyeris
      @silverseyeris Pƙed 2 lety

      i even double checked

  • @The.Smooge
    @The.Smooge Pƙed rokem

    how do i find the "set costume" block?

  • @LiamGames662
    @LiamGames662 Pƙed rokem +1

    Think you for the animation skill im gonna put you in the credits btw

  • @wassimgaming-ty3yo
    @wassimgaming-ty3yo Pƙed měsĂ­cem

    nice tutorial

  • @Ssmlh
    @Ssmlh Pƙed 9 měsĂ­ci

    What is the xinput

  • @javascript7817
    @javascript7817 Pƙed 2 lety +6

    Really cool! Sometimes math can save a ton of headaches!

    • @Mari0Kid1234
      @Mari0Kid1234 Pƙed rokem

      That’s a reason I love math :)

    • @JointFury
      @JointFury Pƙed rokem

      Apart from when math causes headaches lol

  • @dolliethedoll
    @dolliethedoll Pƙed 2 lety +4

    me: what a nice day to watch ShiftClickLear-
    wifi: hi
    me: nvm

  • @LeftyGamez666
    @LeftyGamez666 Pƙed 2 lety +2

    Hey! Really great tutorial, right now I'm trying to make a top down rpg game and for it to work I need to move upwards and downwards with a walking cycle too. You think you can help me?

    • @ShiftClickLearn
      @ShiftClickLearn  Pƙed 2 lety +1

      You'd need to play the correct animation depending on the velocity! Something like this:
      if (velocityX > 0) {
      right animation
      } else if (velocityX < 0) {
      left animation
      } else if (velocityY > 0) {
      up animation
      }
      etc.

    • @LeftyGamez666
      @LeftyGamez666 Pƙed 2 lety

      @@ShiftClickLearn It worked! Thanks bro!

  • @N64Mario
    @N64Mario Pƙed 2 lety +13

    That's an interesting trick to use that kind of script for animating sprites, and it works for most cases.
    However, there are some cases when you want to animate a sprite with their own frame time value. For example, frame 1 may want to last 4 frames, frame 2 may want to last for 1 frame, and frame 3 may want to last for 8 frames. With the mod trick here, you don't have that kind of freedom because every frame is connected to a single value of the _costume variable there.
    Nevertheless, this a great tutorial Nice job!! :)

    • @jeffreygordon7194
      @jeffreygordon7194 Pƙed 2 lety +8

      In that case you could just duplicate the frames. That's usually what I do. This is pretty common to see in sprite sheets in commercial arcade games.

    • @ShiftClickLearn
      @ShiftClickLearn  Pƙed 2 lety +6

      Good point, thanks! :D

  • @cheir1000
    @cheir1000 Pƙed 2 lety +1

    scakekl thx sooooo much

  • @ihatepickles9962
    @ihatepickles9962 Pƙed rokem

    what are those pink blocks