Discuss Scratch

coolboi1002
Scratcher
13 posts

Smooth velocity tutorial.

Want to make your sprite move smoothly? Well, this is the place for you!

- First, you want to make two variables: “X velocity” and "Y velocity.

- Then, make this script:

When green flag clicked,
set to
set to
forever
if <key right arrow pressed?> then
change by (1)
if <key left arrow pressed?> then
change by (-1)
if <key up arrow pressed?> then
change by (1)
if <key down arrow pressed?> then
change by (-1)

end

change x by (X velocity)
change Y by (Y velocity)
set to (X velocity) * (0.9)
set to (Y velocity) * (0.9)

Congrats, you have finished this tutorial!

Last edited by coolboi1002 (Jan. 30, 2024 19:21:31)

Malicondi
Scratcher
1000+ posts

Smooth velocity tutorial.

coolboi1002 wrote:

Want to make your sprite move smoothly? Well, this is the place for you!

- First, you want to make two variables: “X velocity” and "Y velocity.

- Then, make this script:

When green flag clicked,
set to
set to
forever
if <key right arrow pressed?> then
change by (1)
if <key left arrow pressed?> then
change by (-1)
if <key up arrow pressed?> then
change by (1)
if <key down arrow pressed?> then
change by (-1)

end

change x by (X velocity)
change Y by (Y velocity)
set to (X velocity) * (0.9)
set to (Y velocity) * (0.9)

Congrats, you have finished this tutorial!
using (x velocity) * (0.9) at the end is a little slippery like ice, i recommend using .8 or .85

Last edited by Malicondi (Jan. 29, 2024 21:39:57)

coolboi1002
Scratcher
13 posts

Smooth velocity tutorial.

Thanks for your advice!

Powered by DjangoBB