Discuss Scratch

12artem12
Scratcher
14 posts

How to make smooth rotation?

I want to make a sprite rotating, and I want so when I press a button the rotation speed increases and when i release - decreases. I made the same thing with movement, but I can't do it with rotation though.
Mandale_county_333
Scratcher
7 posts

How to make smooth rotation?

Is there already existing code?
ProfessorUelf
Scratcher
100+ posts

How to make smooth rotation?

12artem12
Scratcher
14 posts

How to make smooth rotation?

Is there already existing code?
Yea, but it's as simple as

when green flag clicked
forever
if <key [up arrow v] pressed?> then
change [speed v] by (1)
end
if <not <key [up arrow v] pressed?>> then
change [speed v] by (-1)
end
end
when green flag clicked
forever
if <<(speed) = [0]> or <(speed) < [0]> then
set [speed v] to [0]
end
if <<(speed) = [21]> or <(speed) > [0]> then
set [speed v] to [21]
end
end
idk why the if blocks turned red

Last edited by 12artem12 (Today 14:23:38)

12artem12
Scratcher
14 posts

How to make smooth rotation?

ProfessorUelf wrote:

This should help:

https://scratch-mit-edu.ezproxyberklee.flo.org/projects/733613064
This is great, but not what I needed. I want to rotate the sprite with buttons only.
ProfessorUelf
Scratcher
100+ posts

How to make smooth rotation?

So should it just turn up when pressing up, or start to rotate faster and faster?
12artem12
Scratcher
14 posts

How to make smooth rotation?

ProfessorUelf wrote:

So should it just turn up when pressing up, or start to rotate faster and faster?
It should accelerate when the button is pressed to a certain limit, and when you release the button, on the contrary, it should slow down to zero.

Powered by DjangoBB