Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How Can I Make A Smooth Curve Between Two Points?
- BAG_stud1os
-
Scratcher
3 posts
How Can I Make A Smooth Curve Between Two Points?
In my project, I want one of my sprites to smoothly curve from one point to another. I would like to have a script that I can input an x and y and the script will make the sprite curve to those coordinates. I've had some ideas for how to do that, but nothing seems to work. Any help would be greatly appreciated!
- OhMateo
-
Scratcher
10 posts
How Can I Make A Smooth Curve Between Two Points?
What do you mean? Like gliding in a curved line? 

- deck26
-
Scratcher
1000+ posts
How Can I Make A Smooth Curve Between Two Points?
So you need to define teh type of curve you want - there are lots of ways of moving from A to B in a curved line and how you do it will depend how you want it to appear.
- TestCA1EB
-
Scratcher
68 posts
How Can I Make A Smooth Curve Between Two Points?
In my project, I want one of my sprites to smoothly curve from one point to another. I would like to have a script that I can input an x and y and the script will make the sprite curve to those coordinates. I've had some ideas for how to do that, but nothing seems to work. Any help would be greatly appreciated!
when green flag clickedTry this.
go to x: (0) y: (0)
point in direction (180)
forever
move (1) steps
turn cw (1) degrees
end
- BAG_stud1os
-
Scratcher
3 posts
How Can I Make A Smooth Curve Between Two Points?
What do you mean? Like gliding in a curved line?Sorry for being so vague. It is kinda difficult to explain.

(hopefully this image works)
My idea was this: in the image, point A is the sprite, and point B is the destination.
If possible, I would like to have a custom block that I can put in the coordinates for the destination, and the custom block
would make the sprite curve to the destination. I believe the math would need to use sin and cos, but I'm not quite sure where
they would need to be used.
If this is too complicated or not possible, that is ok. I'm sure I can find another way of doing this or just use the ‘point in direction’ and ‘turn’ blocks.
Hopefully this makes more sense.
- deck26
-
Scratcher
1000+ posts
How Can I Make A Smooth Curve Between Two Points?
So what is known? Is B always lower than A and you want to start going down steeply and then decrease the speed of falling? Or is that just one example? Is there a reason why the curve is that shape?
- BAG_stud1os
-
Scratcher
3 posts
How Can I Make A Smooth Curve Between Two Points?
So what is known? Is B always lower than A and you want to start going down steeply and then decrease the speed of falling? Or is that just one example? Is there a reason why the curve is that shape?I do think for the most part I want the curve to be that shape. However, B shouldn't have to be always lower than A. If A is below, then it can curve in that same way up to B. Sorry for this question being so confusing.
- PutneyCat
-
Scratcher
500+ posts
How Can I Make A Smooth Curve Between Two Points?
You could try a simple Bezier curve. Wikipedia explains the concept and there are various Bezier projects on Scratch, including for example this simple one. What you have drawn could be approximated by a 3-point Bezier curve with A and B as the start and end points, and with the third point having the same x-position as A and the same y-position as B.
Last edited by PutneyCat (May 26, 2020 19:57:10)
- Discussion Forums
- » Help with Scripts
-
» How Can I Make A Smooth Curve Between Two Points?




