Discuss Scratch

Conjureya
Scratcher
17 posts

Using Velocities to Create Smooth Animations

Using Velocities to Create Smooth Animations


____________________________________________________________________________________________________________________

Introduction
_________________

With scratch comes the few non-smooth moving blocks.
move (...) steps
go to x: (...) y: (...)
glide (...) secs to x: (...) y: (...)
change x by (...)
change y by (...)
set x to (...)
set y to (...)
With velocities, you can make your sprites move smoothly, speeding up and slowing down when you want to. Yes, there is the glide block, but if you want your sprite to get faster the farther it moves and slow to a stop then you should use velocities. Actually, using gravity is velocity. This guide will tell you all about them and how to make your animations smoother than ever.







_________________

Usage
_________________

There are many reasons to use velocity instead of default glide and move. To start, velocity can be a game-changer to popularity, because last-minute polishing will make your game more enjoyable. You can go from meh to amazing. Also, velocity can make a game easier to play in some cases. It could be used to create smooth movement for a platformer, or make a falling particle effect. Let us get to the coding!








_________________

Scripting
_________________

First, we will make a simple, one axis velocity. Create a variable named velocity, or whatever you want.
(Velocity)

Now, the real part. This script is making your sprite speed up, the higher the repeat the higher the speed.
when green flag clicked
repeat(...)
move (Velocity) steps
change [Velocity] by (1)
end

To make it slow back down, add this to your script. Make sure
when green flag clicked
repeat(...)
move (Velocity) steps
change [Velocity] by (-1)
end

You have now created a simple yet useful movement script.











_________________

Final Notes
_________________
This can be improved in many ways, so i'm counting on you! Post a link to a project of yours that uses velocities in this topic. This is also my first post, so feedback is appreciated. Scratch on! -Conjureya


Last edited by Conjureya (May 25, 2020 23:40:57)

jettypumpkin07
Scratcher
1000+ posts

Using Velocities to Create Smooth Animations

Is this a tutorial or a question? You could probably find a great place for this post on the Scratch Wiki.
Conjureya
Scratcher
17 posts

Using Velocities to Create Smooth Animations

jettypumpkin07 wrote:

Is this a tutorial or a question? You could probably find a great place for this post on the Scratch Wiki.
Oh, this is supposed to be helping new scratchers with smooth movement

Powered by DjangoBB