Discuss Scratch

Hinderwoods
Scratcher
45 posts

How do you create "smooth" movement in Scratch?

I'm talking about movement that looks natural and not robotic.
jamy_hensley
Scratcher
100+ posts

How do you create "smooth" movement in Scratch?

You need more costumes.
Prscr
Scratcher
100+ posts

How do you create "smooth" movement in Scratch?

Hinderwoods wrote:

I'm talking about movement that looks natural and not robotic.
Use this block:

ScratchSomebodyIDKthisIsReallyPrscrLOL wrote:

glide (1) secs to x: (0) y: (0)

Last edited by Prscr (April 4, 2016 03:41:09)

zp100
Scratcher
100+ posts

How do you create "smooth" movement in Scratch?

What do you mean? Moving across the Stage? You can use this block:
glide (1) secs to x: (0) y: (0)
or this script:
set rotation style [don't rotate v]
point towards [sprite v]
repeat until <touching [sprite v] ?>
move (3) steps
end
set rotation style [all around v]
to accomplish smooth gliding.

Or, do you mean walking movements? If you're using these blocks:
when [right arrow v] key pressed
move (5) steps
when [left arrow v] key pressed
move (-5) steps
then it can look pretty weird. To fix this, use this script:
when green flag clicked
forever
if <key [right arrow v] pressed?> then
move (4) steps
end
if <key [left arrow v] pressed?> then
move (-4) steps
end
end

Hope this help!
gtoal
Scratcher
1000+ posts

How do you create "smooth" movement in Scratch?

Hinderwoods wrote:

I'm talking about movement that looks natural and not robotic.

When you start moving, don't jump straight to the target speed - start at 0 and ramp the speed up.

When you stop, decelerate rather than stopping dead. You might even want to overshoot a tiny bit and bounce back to the final position (for example the second hand of a watch might do this)

It's all about modelling expectations and usually that comes from modelling the physics involved since people are familiar with how real objects move.

If you're following a path, don't turn corners sharply - fit some sort of spline to your path and follow the spline with constant linear velocity.

Keep the derivative of the speed smooth.

G

Hinderwoods
Scratcher
45 posts

How do you create "smooth" movement in Scratch?

gtoal wrote:

Hinderwoods wrote:

I'm talking about movement that looks natural and not robotic.

When you start moving, don't jump straight to the target speed - start at 0 and ramp the speed up.

When you stop, decelerate rather than stopping dead. You might even want to overshoot a tiny bit and bounce back to the final position (for example the second hand of a watch might do this)

It's all about modelling expectations and usually that comes from modelling the physics involved since people are familiar with how real objects move.

If you're following a path, don't turn corners sharply - fit some sort of spline to your path and follow the spline with constant linear velocity.

Keep the derivative of the speed smooth.

G

Thank you
nickwasp
Scratcher
100+ posts

How do you create "smooth" movement in Scratch?

if you want a sort of momentum effect you can use this
when green flag clicked
forever

if <key [right v] pressed?> then
change [Xv v] by (1)

end
if <key [left v] pressed?> then


change [Xv v] by (-1)
end
set[Xv v]to((Xv)*(0.8)//any number less then 1 will work
end
Hinderwoods
Scratcher
45 posts

How do you create "smooth" movement in Scratch?

nickwasp wrote:

if you want a sort of momentum effect you can use this
when green flag clicked
forever

if <key [right v] pressed?> then
change [Xv v] by (1)

end
if <key [left v] pressed?> then


change [Xv v] by (-1)
end
set[Xv v]to((Xv)*(0.8)//any number less then 1 will work
end
Ok
zp100
Scratcher
100+ posts

How do you create "smooth" movement in Scratch?

Oh! That kind of movement. Check out this tutorial for realistic jumping and acceleration, along with everything else for character movement.
raineoden
Scratcher
78 posts

How do you create "smooth" movement in Scratch?

Are you talking about platforming? cuz then you can do it by the post above me by @Hinderwoods!
when green flag clicked
forever

(imagine)
(program)
(share)

end
Hinderwoods
Scratcher
45 posts

How do you create "smooth" movement in Scratch?

zp100 wrote:

Oh! That kind of movement. Check out this tutorial for realistic jumping and acceleration, along with everything else for character movement.
Thank you!
Vinny_0
Scratcher
12 posts

How do you create "smooth" movement in Scratch?

Try

when green flag clicked
forever

if <key [ D] pressed?> then

repeat until <not <key [ D] pressed?>>

change x by (5)
end

end

end

Last edited by Vinny_0 (April 6, 2016 00:18:38)

Hinderwoods
Scratcher
45 posts

How do you create "smooth" movement in Scratch?

Vinny_0 wrote:

Try

when green flag clicked
forever

if <key [ D] pressed?> then

repeat until <not <key [ D] pressed?>>

change x by (5)
end

end

end
This isn't smooth, but thanks for the help anyway.
ethanbros
Scratcher
41 posts

How do you create "smooth" movement in Scratch?

Hinderwoods wrote:

I'm talking about movement that looks natural and not robotic.
If you want a sliding sprite that goes slower as it gets closer to a point, try this:
define slide to x: (x) y: (y) with division of (divide)
repeat until <<(round (x position)) = (x)> and <(round (y position)) = (y)>>
change x by (((x) - (x position)) / (divide))
change y by (((y) - (y position)) / (divide))
end
go to x: (x) y: (y)
If you want to make it simply glide to a position at a constant speed, just use this block.
glide (1) secs to x: (0) y: (0)
If you want to make, let's say, controls for a top-down game, use this:
when green flag clicked
forever
. . .
if <key [up arrow v] pressed?>
change y by (5)
end
if <key [down arrow v] pressed?>
change y by (-5)
end
if <key [left arrow v] pressed?>
change x by (-5)
end
if <key [right arrow v] pressed?>
change x by (5)
end
. . .
end
That's all I can tell you.
MCSniper
Scratcher
2 posts

How do you create "smooth" movement in Scratch?




use these frames for talking when smooth

Last edited by MCSniper (Aug. 21, 2016 23:37:47)

JavierR100
Scratcher
500+ posts

How do you create "smooth" movement in Scratch?

Smooth moving? Where?
Heres is, only with 3 operators blocks (on each command block inputs).
when green flag clicked
forever
go to x: (((mouse x) / (2)) + ((x position) / (2))) y: (((mouse y) / (2)) + ((y position) / (2)))
else
say [Hope this works!]
end
Harakou
Scratcher
1000+ posts

How do you create "smooth" movement in Scratch?

MCSniper wrote:




use these frames for talking when smooth
Please make sure that your posts are on topic.

Closing this thread since it's quite old.

Powered by DjangoBB