ℹ️ This is a follow-up project. Check out the original project and its notes and credits first. Move the points and handles to change the curve.
* Well, like the original project, no math is used to calculate the Bézier curve, but some math is used to calculate positions (see below). This is a more advanced version of the original project. It uses the same method for drawing the cubic Bézier curve, but it does so with just a single sprite. When using a single sprite, we can no longer use the "point towards (sprite)" or "distance to (sprite)" since we have no sprite to use as reference. Instead, we keep track of the positions by storing them in lists, and calculate the direction using trigonometry and the distance using the Pythagorean theorem. As a result, this project has much more code. The original projects has 27 blocks in the Pen sprite, and 11 blocks each in 6 other sprites, so a total of 93 blocks. The sprite in this project has 186 blocks. Why complicate things like this? Because it allows us to add more advanced functionality with very little additional code. As you can see, in this project, the curve is redrawn as you move the points and handles. Doing that in the original project would have been complex and required a lot of code because many sprites would have to work together. Here, we only have to add a few blocks (basically the ones under the "when this sprite clicked" hat block).