Could we please have a double-clicked
option in the when I am []
block?
I think I found a way to create a block that does this, in this project:
Hmm, it doesn't seem to work in this script.
Heres what i think
Clicked? =
{
If <<touching [me]>and<mouse down?>>{
Reset timer
Script var ((a))
Set [a] to (list (mouse x)(mouse y)< >)
Wait until <not>
//(not mouse down. Something is wrong with the forum.
If <(a) = (list (mouse x)(mouse y)< >)>{
Report
}else{
Report
}else{
Report
}
DbClicked=
{
If <clicked?>{
Reset timer
Wait until <<clicked?>or<(timer) more than (desired dbclick speed)>>
If<Not<(timer) more than (desired dbclick speed)>>
Report
}else{
report
}else{
Report
}
}
here's how i would do it:
on start:
timeClicked = 0
on click:
if (currentMillisecond - timeClicked < 500)
--double clicked
end
timeClicked = currentMillisecond
Is that JavaScript? In the case that it isn't JavaScript, how do I translate it to Snap! blocks?
that isn't javascript that's some sort of psuedocode
i changed currentTime to currentSecond to make it more clear
(then changed it to currentMillisecond as I realized the current second isn't a float in snap)
on start is the green flag clicked event, and on click is the clicked event
and timeClicked is the variable timeClicked and currentSecond is the current second from the sensing category
You may try this project Snap! Build Your Own Blocks
Double click is handled The Snap Way by blocks.
Sensing
Generic when, but it's the last resort because checking the condition this way causes unnecessary load.

It runs too slowly to be used in a hat block, which is a real bummer.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.