Discuss Scratch
- Discussion Forums
- » Suggestions
- » Reporter block that will say distance from mouse X and Y
- Umhead22
-
Scratcher
100+ posts
Reporter block that will say distance from mouse X and Y
(distance to (x :: motion) (Y :: motion) :: sensing
Says the distance of the point X and Y. very usefull in interactive games or when you need to make some like appear
Last edited by Umhead22 (Dec. 14, 2024 06:45:13)
- medians
-
Scratcher
1000+ posts
Reporter block that will say distance from mouse X and Y
Mockups:
distance to (sprite v)//already in scratch
distance to x: () y: ()::sensing reporter
distance from x: () y: () to x: () y: ()::sensing reporter
- nikky10000000
-
Scratcher
500+ posts
Reporter block that will say distance from mouse X and Y
Good idea, there is a workaround but that requires a extra sprite which can be annoying when you need a lot these. Support.
- Umhead22
-
Scratcher
100+ posts
Reporter block that will say distance from mouse X and Y
Mockups:I dunno about the last block, cuz ST will just say "You can make it by usingdistance to (sprite v)//already in scratch
distance to x: () y: ()::sensing reporter
distance from x: () y: () to x: () y: ()::sensing reporter
< (Distance to x: (.10) y: (-10) :: sensing) < (Distance to x: (10) y: (10) :: sensing)>
- Umhead22
-
Scratcher
100+ posts
Reporter block that will say distance from mouse X and Y
I just realised I made wrong script
- ametrine_
-
Scratcher
1000+ posts
Reporter block that will say distance from mouse X and Y
a boolean is a block that only returns true or false:
<this is what a boolean looks like>i don't think you're suggesting this block to be a boolean, right?
- Umhead22
-
Scratcher
100+ posts
Reporter block that will say distance from mouse X and Y
a boolean is a block that only returns true or false:Yes, I just wrote bolean so scratcher would look inside<this is what a boolean looks like>i don't think you're suggesting this block to be a boolean, right?
- ametrine_
-
Scratcher
1000+ posts
Reporter block that will say distance from mouse X and Y
Yes, I just wrote bolean so scratcher would look insidewhy not write “reporter” instead
- medians
-
Scratcher
1000+ posts
Reporter block that will say distance from mouse X and Y
The title also should explain what the block is specifically. Reporter can mean a ton of stuff.Yes, I just wrote bolean so scratcher would look insidewhy not write “reporter” instead
- -ElectronicArts-
-
Scratcher
1000+ posts
Reporter block that will say distance from mouse X and Y
(#2)Yeah i see the point. Its lot easier than using a sprite.
Mockups:distance to (sprite v)//already in scratch
distance to x: () y: ()::sensing reporter
distance from x: () y: () to x: () y: ()::sensing reporter
- nembence
-
Scratcher
500+ posts
Reporter block that will say distance from mouse X and Y
It's also a lot easier than the math workaround: (note how every coordinate has to appear twice)
If the coordinates are stored in a list, the math workaround might not fit on the screen
([sqrt v] of ((((X1::custom-arg)-(x2::custom-arg))*((X1::custom-arg)-(x2::custom-arg)))+(((Y1::custom-arg)-(y2::custom-arg))*((Y1::custom-arg)-(y2::custom-arg)))))vs
(distance from x:(X1::custom-arg) y:(Y1::custom-arg) to x:(x2::custom-arg) y:(y2::custom-arg)::sensing)
If the coordinates are stored in a list, the math workaround might not fit on the screen
([sqrt v] of ((((item (index1) of [coords v])-(item (index2) of [coords v]))*((item (index1) of [coords v])-(item (index2) of [coords v])))+(((item ((index1)+(1)) of [coords v])-(item ((index2)+(1)) of [coords v]))*((item ((index1)+(1)) of [coords v])-(item ((index2)+(1)) of [coords v])))))
Last edited by nembence (Dec. 14, 2024 14:46:29)
- Discussion Forums
- » Suggestions
-
» Reporter block that will say distance from mouse X and Y