BEST Way To Animate In Scratch
Вставка
- Опубліковано 27 вер 2024
- 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.ed...
▶ 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....
❗ 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
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)
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
Congrats on 9k dude! You definetly deserve it! 💯💯
Thank you!!!!!
AH HEM. its 10 k now :D
TYSM! I always wanted to learn how to animate a character in a game and now thanks to you I can.
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
Nice! I’m definitely going to show this to the guys down at my animation club!
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!!!
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!
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 :)
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.
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!
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
Honestly you deserve 100k subs btw i was here when you had 3k
Thank you so much!!!
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
this tutorial is actually the best animation i've ever seen. im doing this on a laptop and there's NO LAG.
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 so much for this tutorial
You are so welcome!
Really cool! Sometimes math can save a ton of headaches!
That’s a reason I love math :)
Apart from when math causes headaches lol
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
Thank you for this video you saved my life with scratch
I'll use these tips
Awesome
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)
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!
Thank you so much for this video!!!You help me to complete a animation on scratch
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
How r u so underrated??? Your tutorials are so easy to follow and you are rlly funny aswell!!!
Aww, ty!!! :D
Hey ShiftClickLearn could you make a scrolling backround or someting simmilar to that tutorial? i have trouble figuring out how to make a scrolling backround if the charecter follows the mousepointer! (#hope -u-get-to-10k!!!!!!!!)
That is a great idea! I'll remember that one!
So there’s one way if you want to make this more hard, you just do one forever block and get the go to next costume block put it inside the forever block.
And then your done ✅ but for beginners look at this video instead but for serious pros who want animations to look good do the code I said.
ShiftClickLearn, may you try making a word search scratch video ? I saw Scratch has lots of project about wordle and more... Hope my idea is helpful for you
That's a really good idea
i love your tutorials😄
Thank you Dan Stevers! :D
how do i add a i downloaded to my soft soft so i can resetup it?
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!
I used this to make a custom block that does the switching and stuff and stuff.
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?
when u reach 100k subs, will u remember me?
Nice script, thanks!
me: what a nice day to watch ShiftClickLear-
wifi: hi
me: nvm
LOL
i really apreciate your help with dowloanding this software
You're welcome
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.
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?
Thanks a lot for this tutorial, the only problem is that on the 4 keys (arrrow keys) one's animation doesn't work
Loved this, helped a lot with my game.
something wrong.
my character is switching into their idle in their run
This is helpful so far!
I'm so glad 😊
unlike you said it doesn’t work it just repeats all of my costumes to a pose of just a few pls help me
Think you for the animation skill im gonna put you in the credits btw
You're welcome!! :D
Thank you for this! I need to animate a cartoon for my class.
thank you thats the third time i needed this video
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"
I have a problem where I cannot animate x and y directions at the same time
working fine thank you
You're welcome!
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?
So cool!
tysm this works so well but one thing i need is a running animation 😭😭
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!
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.)
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.
What are all the variables for because I am confuse
im making a rpg game thank you I love your videos
incredibly helpful, you deserve a sub!
how would I do this with more complicated animations?
pls amke a tutorial for the walk cycle for a lot of frames
@ShiftClickLearn hey is there a way to play different animations like a jump into a idle if there is can you respond
Thanks for the help.
If im trying to make a full on animation, is there any way to recreate tweens and frame transitions?
Can we move and jump the uploaded sprite
What do you mean? You can use any costumes/sprites with this if that's what you're asking.
thanks
you don not know how much i wanted to do this :)
This guy is a legend
i love your videos
Thank you!
Hey there, i want to create clones with many animations playing at once, how much can scratch handle before being slowed down?
?
This is helped me. Thanks
I followed the instructions, but I think mine is too complex for that, so it isn't working.
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 :)
this vid was so helpful but i dont know how to make my sprite not walk we'll i jump and move new vid idea.
Thanks! You just need an if statement that checks if you are jumping, then play the jump animation stuff! :D
Thx this really helped
How do i make it go up?
What is the xinput
can u pls add the code so the sprite can be controlled by w and s (up and down)
I can make a tutorial on basic movement- this video's focus wasn't really the movement!
@@ShiftClickLearn ok thx!
This is way to nerdy for me to understand.....
Lol sorry
Just copy the code or stacks u don't need to understand
Rip brain cells
@@ShiftClickLearnnah bro u did a good job at explaining everything
Lol
Funny vid...nice job
Thank you!
how do i make this work in mobile?
ty
Wow good video
Glad you enjoyed!! :D
121K views as of this comment? That shows how little effort people are putting into their CS50 projects. This guy shows us how to excel in our homework.
epic video
Thanks! :D
Nice
the ways be like
hards: easy no give ups B)
simples: somebody lost his brains pls help
XD
the subscribe button has a new animation
WOOOOWOWOWWWW WWOWOWOWO IM COMMENTING ON VIdEo
yay
Mine Doesn't Work :(
Did you copy everything correctly?
It did
I have my profile
?
Not Working
sorry, but for for some reason it not working
OK
Ok
can u animate to jump😅
it din't work😭😭😭
WAHT????????