After seeing so many great mathmatical projects on the front page, I thought it was time to let go of the cartoony race games I make and get started on some serious math.
I've tried a long time now, and I'm stumped. Hopefully one of you guys can help me.
So.. I've got a dot. I set it to pen down, and then it forever glides to a ball that you can drag, creating the image of an extendable string.
First issue-
I want to make a certain range the dot can stamp to. Right now, I have a script that makes a variable that tracks the distance from the Ball Sprite to the original point sprite. If the distance is greater than letsay, 300, then I want it to.... kind of like... go back on the line. The point won't go as far as the ball, but it will still be on the line its supposed to be on, except shorter.
To create the string, I have a script for the dot that says:
Forever
{
Glide to (ball x position)-(x change) y(ball y position)-(y change), where y is the change its supposed to make to go back on the line.
Example-
Line = ----------------------------------------O (ball)
However, let's say this line is too long
Line= -------------------------- O
Like that. Except, instead of a simple change x by -10, it has to be able to be diagnal vertical... etc... I know trig is involved but I dont' know which blocks to use.
Second issue-
I want the rope it creates to be able to swing down in a circular motion. I'm stumped by this becasue, first it has to create an imaginary circle that it follows. I've tried tangents, sines, cosines.... nothing works.
Right now, I've got a point at the top of the rope, a ball at the end of the rope, and a point at the position its supposed to return to.
Somebody help me. If you don't get what I'm saying, say so, and I'll upload the project and then you guys can download it and help me.
Please respond, my hair is turning white with frustration.
tl;dr- I need to create a code that lets the string have a range it can go to.
Offline
Some Help?!
Offline
http://scratch.mit.edu/projects/Greenatic/1884743
Here, this might help. If you need to make the string longer:
Go to the second sprite.
Change the number in the if loop by the number of units you want to increase it by.
For each unit, add another of the "go to" blocks, following the same pattern of addition (x, x+1, x+2, etc.)

Offline