Discuss Scratch
- venyanwarrior
-
Scratcher
1000+ posts
When sprite clicked sensing block
I am currently converting some of my older projects for use with mobile devices using control sprites. Unfortunately, I have to use the
I would prefer to have a boolean like this.
OR this
Plz supprot.
When this sprite clickedscratchblock.
I would prefer to have a boolean like this.
<When [jump sprite v] clicked :: sensing>
OR this
<[something v] is touching [something v]::sensing>This way, I can easily add it to my current platforming script, without having to do some shabby workmanship thrown together in 10 minutes (It's my style.)
Plz supprot.
Last edited by venyanwarrior (May 26, 2018 22:15:30)
- -ShadowOfTheFuture-
-
Scratcher
1000+ posts
When sprite clicked sensing block
<<touching [mouse-pointer v] ?> and <mouse down?>>
Wouldn't that work the same?
- venyanwarrior
-
Scratcher
1000+ posts
When sprite clicked sensing block
Oh, um…….<<touching [mouse-pointer v] ?> and <mouse down?>>
Wouldn't that work the same?
That wouldn't work because I have my platforming script all on my character sprite. This boolean would be useful because it can sense other sprites being touched, and then use it as an input. Otherwise, I could use a when I receive boolean, but that's been rejected.
Last edited by venyanwarrior (May 25, 2018 19:46:07)
- Zekrom01
-
Scratcher
1000+ posts
When sprite clicked sensing block
Workaround:
if <<touching [mouse pointer v] ?> and <mouse down?>> then //sprite 1
broadcast [clicked v]
end
when I receive [clicked v] //sprite 2
...
- venyanwarrior
-
Scratcher
1000+ posts
When sprite clicked sensing block
Workaround:Yeah, but my platforming script is all in one. If I were to use broadcasts, it would have to be a boolean. (Which is rejected)if <<touching [mouse pointer v] ?> and <mouse down?>> then //sprite 1
broadcast [clicked v]
endwhen I receive [clicked v] //sprite 2
...
when green flag clicked
forever
if<<touching [mouse pointer v]> and <mouse down?>> then
broadcast [right clicked]
when green flag clicked
...
if <<key [right arrow v] pressed> or <when I receive [right clicked v]>>then
...
My suggestion makes it much simpler
when green flag clicked
...
if <<key [right arrow v] pressed> or <when [move right v] clicked ::sensing>> then
...
- -ShadowOfTheFuture-
-
Scratcher
1000+ posts
When sprite clicked sensing block
Oh, so you want a boolean that allows for you to tell when any sprite is clicked…
In that case, support. I guess it's workaroundable this way, but it's extremely tedious.
In that case, support. I guess it's workaroundable this way, but it's extremely tedious.
if <<mouse down?> and <>> then
broadcast [message1 v]
end
when gf clicked
set [clicked? v] to [0]
when I receive [message1 v]
set [clicked? v] to [1]
when gf clicked
...
if <(clicked?) = [1]> then
...
set [clicked? v]
- ACE009
-
Scratcher
100+ posts
When sprite clicked sensing block
Maybe we should have a <[… v] is touching [… v]?> block. This would make your specific case more difficult for than your suggestion, but it is a more general and versatile block.
Last edited by ACE009 (May 26, 2018 10:31:23)
- venyanwarrior
-
Scratcher
1000+ posts
When sprite clicked sensing block
Maybe we should have a <[… v] is touching [… v]?> block. This would make your specific case more difficult for than your suggestion, but it is a more general and versatile block.
<[something v] is touching [something v] ::sensing>This could work!
when green flag clicked
...
if <<[mouse v] is touching [left sprite v] ::sensing> and <mouse down?>> then
...
- Happysoul05
-
Scratcher
100+ posts
When sprite clicked sensing block
No support.
2 ways:
You can use some math to detect if mouse is touching button.
Second way:
Have a hidden mouse following spriteAnd have a variavlle to check what it is on.
Like mouse is on > exit
>play
>0//shows nothing.
And use that var in script.
2 ways:
You can use some math to detect if mouse is touching button.
Second way:
Have a hidden mouse following spriteAnd have a variavlle to check what it is on.
Like mouse is on > exit
>play
>0//shows nothing.
And use that var in script.
- venyanwarrior
-
Scratcher
1000+ posts
When sprite clicked sensing block
Do not Support! -1Could you tell me why you don't support?
- kenny2scratch
-
Scratcher
500+ posts
When sprite clicked sensing block
If you have a good idea of what major color your two sprites are, you can use the
<color [#d3bcad] is touching [#55b350] ?>block, but otherwise support for OP reasons.
- ACE009
-
Scratcher
100+ posts
When sprite clicked sensing block
If you have a good idea of what major color your two sprites are, you can use theThat doesn’t work because the first color represents part of the sprite that is executing the block, not just any sprite. If you would like to take a look at the wiki article, you can find it here.<color [#d3bcad] is touching [#55b350] ?>block, but otherwise support for OP reasons.
- TheAdriCoolManDude
-
Scratcher
1000+ posts
When sprite clicked sensing block
I am currently converting some of my older projects for use with mobile devices using control sprites. Unfortunately, I have to use theWorkarounds:When this sprite clickedscratchblock.
I would prefer to have a boolean like this.<When [jump sprite v] clicked :: sensing>
OR this<[something v] is touching [something v]::sensing>This way, I can easily add it to my current platforming script, without having to do some shabby workmanship thrown together in 10 minutes (It's my style.)
Plz supprot.
In Jump Sprite:
when this sprite clickedIn other sprite:
broadcast [send1 v]
when I receive [send1 v]or
...
In Jump Sprite:
if <touching [other sprite v]> thenIn other sprite:
broadcast [send1 v]
end
when I receive [send1 v]
...