Discuss Scratch

DevanWolf
Scratcher
100+ posts

"sprite clicked?" boolean block

I must say to use this block:
<sprite clicked?::sensing>
(usually
<stage clicked?::sensing>
in stage) better than:
<<mouse down?>and<touching[mouse-pointer v]?>>
because it must be better excpet only whenever you hold down the mouse on the sprite it will start/report true, and if you move away from the sprite while holding down or let go it stops/reports false, but if you move your mouse back on the sprite whenever your mouse is down, then nothing will happen anymore/still reports false unless you release and click the sprite again,

For my example, I still want to use:
when flag clicked
forever
if<sprite clicked?::sensing>then
if on edge, bounce
move(5)steps
change[color v]effect by(10)
rather than:
when flag clicked
forever
if<<mouse down?>and<touching [mouse-pointer v]?>>then
if on edge, bounce
move(5)steps
change[color v]effect by(10)
else
wait until<not<mouse down?>>
or:
when this sprite clicked
repeat until<not<<mouse down?>and<touching [mouse-pointer v]?>>>
if on edge, bounce
move(5)steps
change[color v]effect by(10)
So if this suggestion takes so long to be released, people use this workaraound:
when this sprite clicked
set[sprite clicked? v]to[true]
wait until<not<<mouse down?>and<touching [mouse-pointer v]?>>>
set[sprite clicked? v]to[false]
Then we would still use with the variable:
when flag clicked
forever
if<(sprite clicked?)=[true]>then
if on edge, bounce
move(5)steps
change[color v]effect by(10)
See my project here for how the block works.

Last edited by DevanWolf (Aug. 16, 2016 17:25:46)

Firedrake969
Scratcher
1000+ posts

"sprite clicked?" boolean block

It's workaroundable pretty easily, so no support.
DevanWolf
Scratcher
100+ posts

"sprite clicked?" boolean block

Firedrake969 wrote:

It's workaroundable pretty easily, so no support.
I think I will add a better example for a hiding sprite game, because support must be it!
when flag clicked
go to x:(pick random(-240)to(240))y:(pick random(-180)to(180))
set[ghost v]effect to(95)
repeat until<sprite clicked?::sensing>
turn right(5)degrees
end
clear graphic effects
say[You found me!]for(2)secs
set[ghost v]effect to(100)

Last edited by DevanWolf (July 24, 2014 20:16:19)

Firedrake969
Scratcher
1000+ posts

"sprite clicked?" boolean block

That's the same thing as repeat until touching mouse and mouse down. No support, as I've said, because of the easy workaround.
DevanWolf
Scratcher
100+ posts

"sprite clicked?" boolean block

Firedrake969 wrote:

That's the same thing as repeat until touching mouse and mouse down. No support, as I've said, because of the easy workaround.
Read this thing again:
“Whenever you hold down the mouse on the sprite it will start, and if you move away from the sprite while holding down or let go it stops, but if you move your mouse back on the sprite whenever your mouse is down, then nothing will happen anymore unless you release and click the sprite again”
Firedrake969
Scratcher
1000+ posts

"sprite clicked?" boolean block

DevanWolf wrote:

Firedrake969 wrote:

That's the same thing as repeat until touching mouse and mouse down. No support, as I've said, because of the easy workaround.
Read this thing again:
“Whenever you hold down the mouse on the sprite it will start, and if you move away from the sprite while holding down or let go it stops, but if you move your mouse back on the sprite whenever your mouse is down, then nothing will happen anymore unless you release and click the sprite again”
forever
if <<touching [mouse v]> and <mouse down?>>
set [clicking v] to (1)
else
set [clicking v] to (0)
DevanWolf
Scratcher
100+ posts

"sprite clicked?" boolean block

Firedrake969 wrote:

DevanWolf wrote:

Firedrake969 wrote:

That's the same thing as repeat until touching mouse and mouse down. No support, as I've said, because of the easy workaround.
Read this thing again:
“Whenever you hold down the mouse on the sprite it will start, and if you move away from the sprite while holding down or let go it stops, but if you move your mouse back on the sprite whenever your mouse is down, then nothing will happen anymore unless you release and click the sprite again”
forever
if <<touching [mouse v]> and <mouse down?>>
set [clicking v] to (1)
else
set [clicking v] to (0)
Really!? See my project on how the block works again and read the instructions on the right.
Firedrake969
Scratcher
1000+ posts

"sprite clicked?" boolean block

Ok, that's another workaround.
Zro716
Scratcher
1000+ posts

"sprite clicked?" boolean block

how could it be any different than
when this sprite clicked
set [click v] to [true]
wait until <not <mouse down?>>
set [click v] to [false]
DevanWolf
Scratcher
100+ posts

"sprite clicked?" boolean block

Zro716 wrote:

how could it be any different than
when this sprite clicked
set [click v] to [true]
wait until <not <mouse down?>>
set [click v] to [false]
Are you sure? Read my top post carefully.
AonymousGuy
Scratcher
1000+ posts

"sprite clicked?" boolean block

forever
if <mouse down?> then
if <not <touching [mouse-pointer v]>> then
wait until <not <mouse down?>>
else
set [sprite clicked v] to [true]
wait until <not <mouse down?>>
set [sprite clicked v] to [false]
end
end
end
What would you even need this for?

Last edited by AonymousGuy (July 27, 2014 14:56:07)

Firedrake969
Scratcher
1000+ posts

"sprite clicked?" boolean block

DevanWolf wrote:

Zro716 wrote:

how could it be any different than
when this sprite clicked
set [click v] to [true]
wait until <not <mouse down?>>
set [click v] to [false]
Are you sure? Read my top post carefully.
We all have read, and you're actually somewhat denying your own suggestion by proving that there are workarounds.
AnonymousMe
Scratcher
50 posts

"sprite clicked?" boolean block

use once of these codes in this topic and put it in a custom block so you don't have to remember how to do it.
Blaze349
Scratcher
1000+ posts

"sprite clicked?" boolean block

There is no real need for this as you just need to add two more blocks rather than one.
Z-zap
Scratcher
100+ posts

"sprite clicked?" boolean block

DevanWolf wrote:

Firedrake969 wrote:

It's workaroundable pretty easily, so no support.
I think I will add a better example for a hiding sprite game, because support must be it!
when green flag clicked
go to x:(pick random(-240)to(240))y:(pick random(-180)to(180))
set[ghost v]effect to(95)
repeat until<sprite clicked?>
turn right(5)degrees
end
clear graphic effects
say[You found me!]for(2)secs
set[ghost v]effect to(100)
when green flag clicked
go to x:(pick random(-240)to(240))y:(pick random(-180)to(180))
set[ghost v]effect to(95)
repeat until<<touching [Mousepointer v]?> and <mouse down?>>
turn right(5)degrees
end
clear graphic effects
say[You found me!]for(2)secs
set[ghost v]effect to(100)
TheLogFather
Scratcher
1000+ posts

"sprite clicked?" boolean block

DevanWolf wrote:

Firedrake969 wrote:

It's workaroundable pretty easily, so no support.
I think I will add a better example for a hiding sprite game, because support must be it!
when green flag clicked
go to x:(pick random(-240)to(240))y:(pick random(-180)to(180))
set[ghost v]effect to(95)
repeat until<sprite clicked?>
turn right(5)degrees
end
clear graphic effects
say[You found me!]for(2)secs
set[ghost v]effect to(100)
You're almost there - you only need to add a couple of extra blocks:
when green flag clicked
set [sprite clicked? v] to [No]
go to x:(pick random(-240)to(240))y:(pick random(-180)to(180))
set[ghost v]effect to(95)
repeat until < (sprite clicked?) = [Yes] >
turn right(5)degrees
end
clear graphic effects
say[You found me!]for(2)secs
set[ghost v]effect to(100)
when this sprite clicked
set [sprite clicked? v] to [Yes]

BTW, as you've noticed (and @Z-zap above), it's often not really so good to use “touching mouse-pointer?” and “mouse down?” to check for clicking a sprite (also for dragging it), because it doesn't quite act in the expected way. But take a look at this demo project for a better example of how to do such things.

Hope that helps!

Last edited by TheLogFather (July 1, 2014 21:08:34)

realmaster42
Scratcher
52 posts

"sprite clicked?" boolean block

Derp.
NO SUPPORT Because:
when this sprite clicked

*trollface*
Blaze349
Scratcher
1000+ posts

"sprite clicked?" boolean block

realmaster42 wrote:

Derp.
NO SUPPORT Because:
when this sprite clicked

*trollface*
That was unnecessary.
DevanWolf
Scratcher
100+ posts

"sprite clicked?" boolean block

*BUMPS*
//I'm gonna do something with the:
<sprite clicked?::sensing>//It's really cool I still want it!
//I still want to make with the new block coming:
when flag clicked
initialize::custom//Loading
wait until<sprite clicked?::sensing>//Click the "start" button
start game::custom//Start!
...//Add more here to the game start
TimothyLawyer
Scratcher
1000+ posts

"sprite clicked?" boolean block

Firedrake969 wrote:

It's workaroundable pretty easily, so no support.

Powered by DjangoBB