Discuss Scratch

46009361
Scratcher
1000+ posts

Allow the mouse-pointer to be in multiple places at once (touchscreen)

Hi! I want to make it so that users can select whether the stage can hold one or multiple mouse-pointer positions at the same time. If multiple, the three blocks (mouse x), (mouse y), and <mouse down?> will report a list. The first mouse-pointer will be marked as item 1 in each list, the second as #2, etc — and you can insert these blocks (only these) into the dropdowns. However, if you switch the setting from multiple to one, Scratch should automatically remove it from the list dropdown to prevent the thing from breaking. You also shouldn't be able to just edit the JSON file (project.json), because Scratch should also check and then remove it if needed. This is how it would look like:

when green flag clicked
wait until <mouse down?>
wait (0.3) secs
if <<(item (1) of <mouse down?> :: list) = [true]> and <<(item (2) of <mouse down?> :: list) = [true]> and <(length of <mouse down?>) = [2]>>> then
broadcast [mobile v]
else
broadcast [desktop v]
end
Actually, there should now be three settings instead of two: one-touch, two-touch, and multi-touch. For everything except for one-touch, the three mouse-pointer blocks should be treated as lists of numbers/booleans converted into strings, instead of reporting a number or boolean. When you have a block like this, though:
<touching [mouse-pointer v] ?>
It will also be reported as a list as well. True if the first touch is touching the sprite, otherwise false, on #1 in the list. The same for #2 (except that it's on a different position in a list), #3, the twentieth touch, etc.

Last edited by 46009361 (March 6, 2020 20:15:31)

46009361
Scratcher
1000+ posts

Allow the mouse-pointer to be in multiple places at once (touchscreen)

Bump

Last edited by 46009361 (Dec. 20, 2020 21:39:00)

imfh
Scratcher
1000+ posts

Allow the mouse-pointer to be in multiple places at once (touchscreen)

I wouldn’t want this as part of default Scratch. However, I wouldn’t mind it was part of an extension. Personally I think that it would be really neat if Scratch had some sort of mobile extension which allowed access to the gyroscope and other mobile sensors.
46009361
Scratcher
1000+ posts

Allow the mouse-pointer to be in multiple places at once (touchscreen)

imfh wrote:

I wouldn’t want this as part of default Scratch. …
Is it possible to make this part of the default Scratch website, though?
imfh
Scratcher
1000+ posts

Allow the mouse-pointer to be in multiple places at once (touchscreen)

kChiaEC19 wrote:

imfh wrote:

I wouldn’t want this as part of default Scratch. …
Is it possible to make this part of the default Scratch website, though?
What I mean is that I think it would be better for there to be dedicated blocks for detecting touches. I think it would be both a lot easier for the Scratch Team to program and more intuitive.

Maybe something like this:
(touch x (1) ::sensing)
(touch y (1) ::sensing)
(# of touches ::sensing)

Or alternatively like this:

when screen touched (touch x::sensing) (touch y::sensing) ::sensing hat

when touch moved (touch x::sensing) (touch y::sensing) ::sensing hat // Maybe old position, change, or speed too?

when touch released (touch x::sensing) (touch y::sensing) ::sensing hat
46009361
Scratcher
1000+ posts

Allow the mouse-pointer to be in multiple places at once (touchscreen)

imfh wrote:

46009361 wrote:

imfh wrote:

I wouldn’t want this as part of default Scratch. …
Is it possible to make this part of the default Scratch website, though?
What I mean is that I think it would be better for there to be dedicated blocks for detecting touches. I think it would be both a lot easier for the Scratch Team to program and more intuitive.
What I mean, however, is if it is possible for this to actually be implemented — due to the limitations of HTML, CSS, and JavaScript coding.

Last edited by 46009361 (Feb. 26, 2021 07:30:21)

imfh
Scratcher
1000+ posts

Allow the mouse-pointer to be in multiple places at once (touchscreen)

kChiaEC19 wrote:

imfh wrote:

kChiaEC19 wrote:

imfh wrote:

I wouldn’t want this as part of default Scratch. …
Is it possible to make this part of the default Scratch website, though?
What I mean is that I think it would be better for there to be dedicated blocks for detecting touches. I think it would be both a lot easier for the Scratch Team to program and more intuitive.
What I mean, however, is if it is possible for this to actually be implemented — due to the limitations of HTML, CSS, and JavaScript coding.
Yep, both multitouch detection and gyroscope detection are possible.

https://developer.mozilla.org/en-US/docs/Web/API/Touch_events/Multi-touch_interaction
https://developer.mozilla.org/en-US/docs/Web/API/Gyroscope

Last edited by imfh (March 5, 2020 01:51:32)

Maximouse
Scratcher
1000+ posts

Allow the mouse-pointer to be in multiple places at once (touchscreen)

Support. This should be in a “multitouch” extension.
46009361
Scratcher
1000+ posts

Allow the mouse-pointer to be in multiple places at once (touchscreen)

imfh wrote:

Yep, both multitouch detection and gyroscope detection are possible.

https://developer.mozilla.org/en-US/docs/Web/API/Touch_events/Multi-touch_interaction
https://developer.mozilla.org/en-US/docs/Web/API/Gyroscope
I already know that gyroscope is possible (there's already a physical device extension for it, which not everyone has, and it doesn't detect directly from the device) because of Google's bubble level, but we should also have a block as to whether or not the user has granted permission in advance for the gyroscope one.
--Explosion--
Scratcher
1000+ posts

Allow the mouse-pointer to be in multiple places at once (touchscreen)

Support! I personally don't use mobile for scratch, but I think this would be very usefull! Also, perhaps make another extention for mobile controls?
46009361
Scratcher
1000+ posts

Allow the mouse-pointer to be in multiple places at once (touchscreen)

--Explosion-- wrote:

…make another extention for mobile controls?
We can already check if the mouse-pointer is down and what its x and y values are at any given moment.
Maximouse
Scratcher
1000+ posts

Allow the mouse-pointer to be in multiple places at once (touchscreen)

kChiaEC19 wrote:

--Explosion-- wrote:

…make another extention for mobile controls?
We can already check if the mouse-pointer is down and what its x and y values are at any given moment.
But on mobile, the “mouse pointer” can be on multiple positions at once.
46009361
Scratcher
1000+ posts

Allow the mouse-pointer to be in multiple places at once (touchscreen)

Yep, both multitouch detection and gyroscope detection are possible.

https://developer.mozilla.org/en-US/docs/Web/API/Touch_events/Multi-touch_interaction
https://developer.mozilla.org/en-US/docs/Web/API/Gyroscope
I read the multi-touch article, and there seems to be three modes: one-finger-touch, two-finger-touch, and more-than-two-finger-touch. So, I will now edit the OP in order to make it three settings instead of two.
Sheep_maker
Scratcher
1000+ posts

Allow the mouse-pointer to be in multiple places at once (touchscreen)

Would require first class lists, which aren't a thing on Scratch yet

kChiaEC19 wrote:

Yep, both multitouch detection and gyroscope detection are possible.

https://developer.mozilla.org/en-US/docs/Web/API/Touch_events/Multi-touch_interaction
https://developer.mozilla.org/en-US/docs/Web/API/Gyroscope
I read the multi-touch article, and there seems to be three modes: one-finger-touch, two-finger-touch, and more-than-two-finger-touch. So, I will now edit the OP in order to make it three settings instead of two.
No, that's just their example. JavaScript can detect an unlimited number of pointers (pens, mouse cursors, and fingers). There doesn't need to be specific settings for it
Maximouse
Scratcher
1000+ posts

Allow the mouse-pointer to be in multiple places at once (touchscreen)

46009361
Scratcher
1000+ posts

Allow the mouse-pointer to be in multiple places at once (touchscreen)

Maximouse wrote:

Related
Not perfectly duplicate.

Last edited by 46009361 (March 7, 2020 14:33:20)

Maximouse
Scratcher
1000+ posts

Allow the mouse-pointer to be in multiple places at once (touchscreen)

kChiaEC19 wrote:

Maximouse wrote:

Related
Not perfectly duplicate.

I didn't want to say that this is a duplicate, but it is suggesting a similar thing.
46009361
Scratcher
1000+ posts

Allow the mouse-pointer to be in multiple places at once (touchscreen)

Bump again.

I hope it is at least 24 hours. I'll look at the post timestamps after posting this.
TedtheFluffy
Scratcher
4 posts

Allow the mouse-pointer to be in multiple places at once (touchscreen)

I agree with this. It is very annoying to have to let go of the joystick in order to push the attack button.
dominic305
Scratcher
500+ posts

Allow the mouse-pointer to be in multiple places at once (touchscreen)

imfh wrote:

I wouldn’t want this as part of default Scratch. However, I wouldn’t mind it was part of an extension. Personally I think that it would be really neat if Scratch had some sort of mobile extension which allowed access to the gyroscope and other mobile sensors.
An extension for it would be great!

Powered by DjangoBB