BEST Way To Animate In Scratch
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!
Hi everyone! I hope this tutorial helped you out animating your characters! :D
Woooohooooo
thanks its very helpfulđ„đ„đ„
It did for sure! Next u could make a animaiting/drawing tutorial!
yea
Right what I needed!
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!!
You're very welcome, glad I could help. :D
Great job on this. These short explanation videos that focus on a single key concept really stand out among scratch tutorials on CZcams.
Glad it was helpful!
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!
You are very welcome!
its because it stays at the costume for longer
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!
I should've looked up a video about this sooner, It would've saved me SOOOO much time. THANK YOU!!!
TYSM! I always wanted to learn how to animate a character in a game and now thanks to you I can.
Nice! Iâm definitely going to show this to the guys down at my animation club!
this tutorial is actually the best animation i've ever seen. im doing this on a laptop and there's NO LAG.
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)
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 :)
Congrats on 9k dude! You definetly deserve it! đŻđŻ
Thank you!!!!!
AH HEM. its 10 k now :D
Thank you so much for this video!!!You help me to complete a animation on scratch
Loved this, helped a lot with my game.
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.
Hello Owen!
Can't wait to you reach 10K subs :p
who is owen?
@@nikolangot Owen is ShiftClickLearn's actual name, you don't think his birth certificate has his channels name on it do you? :p
Hiya! I can't either!
Thanks! I was trying for 1 week to do this by myself and i couldn't do it. Subscribed!
You're welcome! Glad it helped! :D
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
Glad I could help!
@@ShiftClickLearn (:
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
THANK YOU SO MUCHHHHHH I NEEDED THISSS
Thank you for this! I need to animate a cartoon for my class.
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?
How r u so underrated??? Your tutorials are so easy to follow and you are rlly funny aswell!!!
Aww, ty!!! :D
If im trying to make a full on animation, is there any way to recreate tweens and frame transitions?
Hey there, i want to create clones with many animations playing at once, how much can scratch handle before being slowed down?
?
how do i add a i downloaded to my soft soft so i can resetup it?
thank you thats the third time i needed this video
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?
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)
You wanna know what im planning on?
@@Nightgames_YT_949 ...sure
@@kostasismename9493 Im planning on to make a Fanmade Murder drone movie.With good ending.
Me when @ShiftClickLearn uploads a video : YAYAYAYAYAYAYAYAYAYAYAYAYAYAYAYAYAYA(happiness)
Honestly you deserve 100k subs btw i was here when you had 3k
Thank you so much!!!
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)
@ShiftClickLearn hey is there a way to play different animations like a jump into a idle if there is can you respond
COOOOOOOOOOOOOOOOOOOOOOOOOOOOL TUTORIALS !!!!!!!!!
THAAAAANKS !!!! LOL
tysm, i remebered i had to use a mod block but not sure where you help me so much
How do I make it so when it exits the screen it comes back through the other side
Thank you SO MUCH, I needed this
You're so welcome! :D
I'll use these tips
Awesome
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 :)
thanks
you don not know how much i wanted to do this :)
Thank you so much for this tutorial
You are so welcome!
Thanks you're the best you just gained a follower
Yes
Yay
Nice! I might use this one day!
Awesome! :D
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?
how would I do this with more complicated animations?
Thanks for the help.
Awesome this is way to cool !!!
I love animations.
:D
is there a way to do this wiith animations
incredibly helpful, you deserve a sub!
Hey ShiftClick can you do a tutorial on how to make the google Scoville game. and i loved the viedo
I haven't played that game. I will have to check it out!
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?
This is helped me. Thanks
i spend 20 mins trying to fix it and i just had to this video!!
How can you make it so you can use W and S?
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)
just have the total costumes to be 1 and speed to 0.
@@LostDeveloper871 Please elaborate.
Thank You! This is So Useful!!! :D
You're welcome Recrafted! Glad I could help! :D
What are all the variables for because I am confuse
ShiftClickLearn is a legend
yo bro, really thankya. Big respect
Thanks at the first part of the vid when i did all of your code it was laggy but when i finished not anymore!
No problem!
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!
Thx this really helped
So cool!
tysm this works so well but one thing i need is a running animation đđ
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?
yep
3 months later
Nice script, thanks!
How do i make it go up?
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
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.
@@ShiftClickLearn did that, the thing is completely static now.
Thanks a lot for this tutorial, the only problem is that on the 4 keys (arrrow keys) one's animation doesn't work
How do i do this if i set up my movement and collisions with your other tutorial for collisions?
You would make a platformer, then just add this animation code in a loop. (A forever loop or a when I receive loop.)
I used this to make a custom block that does the switching and stuff and stuff.
This guy is a legend
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 :)
you remove the "POINT IN DIRECTION Ximput x 90"
You are the Best! Thank you so much! đ
You're very welcome, thanks! :D
i really apreciate your help with dowloanding this software
You're welcome
thank you!
You're welcome!
working fine thank you
You're welcome!
brilliant!
Thanks u too much. U help me a lot.
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+
:D
Nice video!
Thanks!!
how do i make this work in mobile?
Question: For the idle animation, how to you make the frame for example, go to 1-5 than go backwards, if that makes sense.
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
@@ShiftClickLearn Its okay I found another way! But thanks for your help, sounds more effective than back a dupe of the costumeXD.
That's genius, mate!
Thanks a lot!
Ty!!
I have a problem where I cannot animate x and y directions at the same time
how to make this go up and down?
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?
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?
@@ShiftClickLearn yup!
i even double checked
how do i find the "set costume" block?
you make it
Think you for the animation skill im gonna put you in the credits btw
You're welcome!! :D
nice tutorial
What is the xinput
Really cool! Sometimes math can save a ton of headaches!
Thatâs a reason I love math :)
Apart from when math causes headaches lol
me: what a nice day to watch ShiftClickLear-
wifi: hi
me: nvm
LOL
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?
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.
@@ShiftClickLearn It worked! Thanks bro!
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!! :)
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.
Good point, thanks! :D
scakekl thx sooooo much
You're welcome!
what are those pink blocks