Discuss Scratch
- Discussion Forums
- » Suggestions
- » Additional operator blocks
- HTML-Fan
-
Scratcher
1000+ posts
Additional operator blocks
Hello!
Something that is sometimes really annoying is the lack of an atan2 and an a²+b²=c² function. Would blocks like this be possible:
Something that is sometimes really annoying is the lack of an atan2 and an a²+b²=c² function. Would blocks like this be possible:
([ atan2] of (a) and (b) :: operators)I know that you can build them, but it's annoying and less understandable.
([ sqrt(a²+b²)] of (a) and (b) :: operators)
Last edited by HTML-Fan (June 26, 2020 19:08:14)
- fdreerf
-
Scratcher
1000+ posts
Additional operator blocks
This would require a new block with two inputs, and at that point it becomes unclear what functions to put in it.
Do we put every function and equation with two inputs?
Do we put every function and equation with two inputs?
- HTML-Fan
-
Scratcher
1000+ posts
Additional operator blocks
No, you don't need
Oops, I made a mistake. I mean sqrt(a²+b²).
And atan and atan2 are different things.
([abs] of (x) or (y) :: operators), do you?
Oops, I made a mistake. I mean sqrt(a²+b²).
And atan and atan2 are different things.
Last edited by HTML-Fan (June 26, 2020 18:35:20)
- HTML-Fan
-
Scratcher
1000+ posts
Additional operator blocks
Something like
(constrain (value) (min) (max) :: operators)would also be really useful for collision detection between circles and rectangles.
Last edited by HTML-Fan (June 26, 2020 18:45:10)
- Seth_Zaw
-
Scratcher
100+ posts
Additional operator blocks
I dunno what “atan2” means, but I have a workaround for the bottom block:
(((a)*(a)) + ((b)*(b)))
- Seth_Zaw
-
Scratcher
100+ posts
Additional operator blocks
Something likeWhy can't you use(constrain (value) (min) (max) :: operators)would also be really useful for collision detection between circles and rectangles.
<touching [rectangle v] ?>
- HTML-Fan
-
Scratcher
1000+ posts
Additional operator blocks
I dunno what “atan2” means, but I have a workaround for the bottom block:atan2 is something like point to x: () y: () and you need about 8 blocks below each other to build it, so it looks kinda ugly.(((a)*(a)) + ((b)*(b)))
Yes, a workaround, but I want it to be on hand when I need it, I don't want to build it.
That works with sprites. But I code pen engines, because I don't like sprites and their collision detection.Something likeWhy can't you use(constrain (value) (min) (max) :: operators)would also be really useful for collision detection between circles and rectangles.<touching [rectangle v] ?>
Last edited by HTML-Fan (June 26, 2020 19:07:31)
- Seth_Zaw
-
Scratcher
100+ posts
Additional operator blocks
Too bad! You'll just have to use sprites, because constrains are really confusing to beginner Scratchers.I dunno what “atan2” means, but I have a workaround for the bottom block:atan2 is something like point to x: () y: () and you need about 8 blocks below each other to build it, so it looks kinda ugly.(((a)*(a)) + ((b)*(b)))
Yes, a workaround, but I want it to be on hand when I need it, I don't want to build it.That works with sprites. But I code pen engines, because I don't like sprites and their collision detection.Something likeWhy can't you use(constrain (value) (min) (max) :: operators)would also be really useful for collision detection between circles and rectangles.<touching [rectangle v] ?>
- HTML-Fan
-
Scratcher
1000+ posts
Additional operator blocks
Too bad! You'll just have to use sprites, because constrains are really confusing to beginner Scratchers.I could use
set [result v] to [value]but for a rectangle you have to do this twice and that makes the collision detection code really long.
if <[result] < [min]> then
set [result v] to [min]
end
if <[result] > [max]> then
set [result v] to [max]
end
And why is it confusing? It just keeps the value between a min and a max value.
Last edited by HTML-Fan (June 26, 2020 19:17:00)
- HTML-Fan
-
Scratcher
1000+ posts
Additional operator blocks
Maybe those operators with multiple inputs could be included in
([ v] of (9) :: operators)
Last edited by HTML-Fan (June 27, 2020 08:20:37)
- HTML-Fan
-
Scratcher
1000+ posts
Additional operator blocks
*bump*
This isn't confusing. It's more confusing to see the lack of such a function.
This isn't confusing. It's more confusing to see the lack of such a function.
- Discussion Forums
- » Suggestions
-
» Additional operator blocks


