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
When this sprite clicked
scratchblock.

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

-ShadowOfTheFuture- wrote:

<<touching [mouse-pointer v] ?> and <mouse down?>>

Wouldn't that work the same?
Oh, um…….

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

Zekrom01 wrote:

Workaround:

if <<touching [mouse pointer v] ?> and <mouse down?>> then //sprite 1
broadcast [clicked v]
end

when I receive [clicked v] //sprite 2
...
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)

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.

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

ACE009 wrote:

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
...
venyanwarrior
Scratcher
1000+ posts

When sprite clicked sensing block

bump
venyanwarrior
Scratcher
1000+ posts

When sprite clicked sensing block

bomp
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.
venyanwarrior
Scratcher
1000+ posts

When sprite clicked sensing block

Bump (2nd page)
ScratchDiogoh
Scratcher
1000+ posts

When sprite clicked sensing block

Do not Support! -1
venyanwarrior
Scratcher
1000+ posts

When sprite clicked sensing block

ScratchDiogoh wrote:

Do not Support! -1
Could you tell me why you don't support?
venyanwarrior
Scratcher
1000+ posts

When sprite clicked sensing block

bump
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

kenny2scratch wrote:

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.
That 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.
venyanwarrior
Scratcher
1000+ posts

When sprite clicked sensing block

bomp
TheAdriCoolManDude
Scratcher
1000+ posts

When sprite clicked sensing block

venyanwarrior wrote:

I am currently converting some of my older projects for use with mobile devices using control sprites. Unfortunately, I have to use the
When this sprite clicked
scratchblock.

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.


Workarounds:
In Jump Sprite:
when this sprite clicked
broadcast [send1 v]
In other sprite:
when I receive [send1 v]
...
or
In Jump Sprite:
if <touching [other sprite v]> then
broadcast [send1 v]
end
In other sprite:
when I receive [send1 v]
...
venyanwarrior
Scratcher
1000+ posts

When sprite clicked sensing block

bump

Powered by DjangoBB