Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Need Help With This Circle.
- Elijah999999
-
1000+ posts
Need Help With This Circle.
Project.
I need to calculate how far out the side of the circle is based on how far up the mouse is. I can't use sin or cosine, because the only information available is the Y coordinate. Please see the project for a demonstration.
Is this even possible? Thanks.
I need to calculate how far out the side of the circle is based on how far up the mouse is. I can't use sin or cosine, because the only information available is the Y coordinate. Please see the project for a demonstration.
Is this even possible? Thanks.
- P0rpleStar
-
100+ posts
Need Help With This Circle.
Hmm, judging by the comment you left on one of your scripts, I think I know an alternative to how to solve your problem. I could write it down and you could try to copy what I'm explaining, or I can remix your project and you can just use my script.
- P0rpleStar
-
100+ posts
Need Help With This Circle.
I went ahead and just remixed your project. If this isn't what you wanted then let me know.
https://scratch-mit-edu.ezproxyberklee.flo.org/projects/1136223209/
https://scratch-mit-edu.ezproxyberklee.flo.org/projects/1136223209/
- Elijah999999
-
1000+ posts
Need Help With This Circle.
I appreciate your help, but that isn't quite what I'm looking for. I want to be able to calculate the width of the circle at a certain Y position, without taking the mouse's X into account. In your example, you made it point towards the mouse, taking both X and Y into account. I went ahead and just remixed your project. If this isn't what you wanted then let me know.
https://scratch-mit-edu.ezproxyberklee.flo.org/projects/1136223209/
I changed the animation in my project to demonstrate it better.
- PaSc_Clan
-
64 posts
Need Help With This Circle.
Project.
I need to calculate how far out the side of the circle is based on how far up the mouse is. I can't use sin or cosine, because the only information available is the Y coordinate. Please see the project for a demonstration.
Is this even possible? Thanks.
Okay, so your question is slightly confusing. I would rewrite it to something like this: “If I draw a horizontal line across a circle at a certain Y value, how could I calculate the distance the circle extends on each side?”
That aside, Does this meet your standards?
define Calculate Distance (size) (y)
set [distance v] to ([2] * ([sqrt v] of ((((size) / [2]) * ((size) / [2])) - ((y) * (y)))))
Here is a small demonstration: https://scratch-mit-edu.ezproxyberklee.flo.org/projects/1136251565/
Last edited by PaSc_Clan (Feb. 19, 2025 17:52:49)
- Elijah999999
-
1000+ posts
Need Help With This Circle.
Well poorly worded question or not, you gave an excellent answer. Thanks!Project.
I need to calculate how far out the side of the circle is based on how far up the mouse is. I can't use sin or cosine, because the only information available is the Y coordinate. Please see the project for a demonstration.
Is this even possible? Thanks.
Okay, so your question is slightly confusing. I would rewrite it to something like this: “If I draw a horizontal line across a circle at a certain Y value, how could I calculate the distance the circle extends on each side?”
That aside, Does this meet your standards?define Calculate Distance (size) (y)
set [distance v] to ([2] * ([sqrt v] of ((((size) / [2]) * ((size) / [2])) - ((y) * (y)))))
Here is a small demonstration: https://scratch-mit-edu.ezproxyberklee.flo.org/projects/1136251565/
- PaSc_Clan
-
64 posts
Need Help With This Circle.
Well poorly worded question or not, you gave an excellent answer. Thanks!Project.
I need to calculate how far out the side of the circle is based on how far up the mouse is. I can't use sin or cosine, because the only information available is the Y coordinate. Please see the project for a demonstration.
Is this even possible? Thanks.
Okay, so your question is slightly confusing. I would rewrite it to something like this: “If I draw a horizontal line across a circle at a certain Y value, how could I calculate the distance the circle extends on each side?”
That aside, Does this meet your standards?define Calculate Distance (size) (y)
set [distance v] to ([2] * ([sqrt v] of ((((size) / [2]) * ((size) / [2])) - ((y) * (y)))))
Here is a small demonstration: https://scratch-mit-edu.ezproxyberklee.flo.org/projects/1136251565/
No problem!
- Discussion Forums
- » Help with Scripts
-
» Need Help With This Circle.