Discuss Scratch

A-no-meep
Scratcher
100+ posts

Add detection for touching clones of self

The Scratch team should make the <if touching> boolean so that you can have a sprite detect whether it is touching a clone of itself.
Detection by color could be used if your project was not visual effect heavy, but most of the projects I make I want to be visual effect heavy, i.e. using screen size sprites to have nighttime levels look darker by ghost effects.
Currently, if you have a sprite with a <if touching (name of sprite)> it will always be true.
If you can use a <if touching> boolean to detect clones will help allow games to have visual effects and many colliding boxes.
Zparx
Scratcher
500+ posts

Add detection for touching clones of self

A-no-meep
Scratcher
100+ posts

Add detection for touching clones of self

That project does not fill the purpose I want. I need to detect whether a sprite is touching a clone of itself, not telling apart between 3 clones of a different sprite.
millerchip
Scratcher
2 posts

Add detection for touching clones of self

+1 on this request: I want to create a number of clones, and then detect when any 2 clones touch. I have a feeling there's a workaround, but I suspect that detection (within this workaround) will be an order n^2 operation (where n = # of clones).
ChildCritic
Scratcher
500+ posts

Add detection for touching clones of self

Make a separate sprite and create this script:
<touching [sprite in question v] ?>
and then drag it to the icon on the sprite panel of that sprite.
you now have clone of self detection.
DaSpudLord
Scratcher
1000+ posts

Add detection for touching clones of self

ChildCritic wrote:

Make a separate sprite and create this script:
<touching [sprite in question v] ?>
and then drag it to the icon on the sprite panel of that sprite.
you now have clone of self detection.
^^^
However, I still support being able to select the sprite from the dropdown from within that sprite.
TheLogFather
Scratcher
1000+ posts

Add detection for touching clones of self

It'd be possible if we could do this:
hide
if < touching [Sprite1 v]> then // "Sprite1" is name of itself
...
end
show
When ‘Sprite1’ is showing it always gives “true” for ‘touching Sprite1’, so it's no good just checking if touching itself.

But, as shown above, we could hide it first, and then check if it is touching any of its clones.

Unfortunately, we also can't do that because the *one thing* that a hidden sprite/clone can't detect is touching other (non-hidden) sprites/clones.

See here for a demo of this odd inconsistency: https://scratch-mit-edu.ezproxyberklee.flo.org/projects/56442484/

Last edited by TheLogFather (Jan. 1, 2016 17:23:29)

millerchip
Scratcher
2 posts

Add detection for touching clones of self

I think I've created a project that does what I want: it's not perfect, but it seems to work.
https://scratch-mit-edu.ezproxyberklee.flo.org/projects/92827970/
calulord
Scratcher
100+ posts

Add detection for touching clones of self

My idea for a feature on scratch is that If in the program a clone of a sprite can be created then in blocks where you pick a sprite (for example “the touching sprite” sensor block) you can select “Clone of (sprite name)” Here is what is might look like.
<touching [Clone of sprite1 v] ?>
jromagnoli
Scratcher
1000+ posts

Add detection for touching clones of self

Duplicate suggestion, I'll try to find the link.
TheLogFather
Scratcher
1000+ posts

Add detection for touching clones of self

calulord wrote:

<touching [Clone of sprite1 v] ?>
Presumably that will be true if touching *any* clone of sprite1, right?

So how is it different to the current “touching sprite1?” block (which is also true if touching any clone of sprite1)?

Does it give false if it's touching the *original* sprite? Even if so, I can't say I see that much use for it…

Otherwise, what does it give that the current “touching sprite1?” does not give?

The only thing I can see that would be useful would be a way to target a *specific* clone (e.g. “touching clone# 3 of sprite1?”) – but it's way too difficult to find a good & intuitive way to reference specific clones like this.

Last edited by TheLogFather (Feb. 25, 2017 16:55:21)

calulord
Scratcher
100+ posts

Add detection for touching clones of self

TheLogFather wrote:

calulord wrote:

<touching [Clone of sprite1 v] ?>
Presumably that will be true if touching *any* clone of sprite1, right?

So how is it different to the current “touching sprite1?” block (which is also true if touching any clone of sprite1)?

Does it give false if it's touching the *original* sprite? Even if so, I can't say I see that much use for it…

Otherwise, what does it give that the current “touching sprite1?” does not give?

The only thing I can see that would be useful would be a way to target a *specific* clone (e.g. “touching clone# 3 of sprite1?”) – but it's way too difficult to find a good & intuitive way to reference specific clones like this.


You seriously can't come up with a good use for this.
WolfCat67
Scratcher
1000+ posts

Add detection for touching clones of self

calulord wrote:

TheLogFather wrote:

calulord wrote:

<touching [Clone of sprite1 v] ?>
Presumably that will be true if touching *any* clone of sprite1, right?

So how is it different to the current “touching sprite1?” block (which is also true if touching any clone of sprite1)?

Does it give false if it's touching the *original* sprite? Even if so, I can't say I see that much use for it…

Otherwise, what does it give that the current “touching sprite1?” does not give?

The only thing I can see that would be useful would be a way to target a *specific* clone (e.g. “touching clone# 3 of sprite1?”) – but it's way too difficult to find a good & intuitive way to reference specific clones like this.


You seriously can't come up with a good use for this.
The current “touching” blocks also work with clones, and you can detect them if you have a “this-sprite-only” variable on the sprite you want to touch, plus some broadcasts. Workarounds, and also there isn't really too much of a use for it…
alexphan
Scratcher
1000+ posts

Add detection for touching clones of self

calulord wrote:

TheLogFather wrote:

calulord wrote:

<touching [Clone of sprite1 v] ?>
Presumably that will be true if touching *any* clone of sprite1, right?

So how is it different to the current “touching sprite1?” block (which is also true if touching any clone of sprite1)?

Does it give false if it's touching the *original* sprite? Even if so, I can't say I see that much use for it…

Otherwise, what does it give that the current “touching sprite1?” does not give?

The only thing I can see that would be useful would be a way to target a *specific* clone (e.g. “touching clone# 3 of sprite1?”) – but it's way too difficult to find a good & intuitive way to reference specific clones like this.


You seriously can't come up with a good use for this.
Well, you haven't listed any examples of how this block would be useful, so maybe that will help?
calulord
Scratcher
100+ posts

Add detection for touching clones of self

WolfCat67 wrote:

calulord wrote:

TheLogFather wrote:

calulord wrote:

<touching [Clone of sprite1 v] ?>
Presumably that will be true if touching *any* clone of sprite1, right?

So how is it different to the current “touching sprite1?” block (which is also true if touching any clone of sprite1)?

Does it give false if it's touching the *original* sprite? Even if so, I can't say I see that much use for it…

Otherwise, what does it give that the current “touching sprite1?” does not give?

The only thing I can see that would be useful would be a way to target a *specific* clone (e.g. “touching clone# 3 of sprite1?”) – but it's way too difficult to find a good & intuitive way to reference specific clones like this.


You seriously can't come up with a good use for this.
The current “touching” blocks also work with clones, and you can detect them if you have a “this-sprite-only” variable on the sprite you want to touch, plus some broadcasts. Workarounds, and also there isn't really too much of a use for it…

1- I tried It and it didn't work.

alexphan wrote:

calulord wrote:

TheLogFather wrote:

calulord wrote:

<touching [Clone of sprite1 v] ?>
Presumably that will be true if touching *any* clone of sprite1, right?

So how is it different to the current “touching sprite1?” block (which is also true if touching any clone of sprite1)?

Does it give false if it's touching the *original* sprite? Even if so, I can't say I see that much use for it…

Otherwise, what does it give that the current “touching sprite1?” does not give?

The only thing I can see that would be useful would be a way to target a *specific* clone (e.g. “touching clone# 3 of sprite1?”) – but it's way too difficult to find a good & intuitive way to reference specific clones like this.


You seriously can't come up with a good use for this.
Well, you haven't listed any examples of how this block would be useful, so maybe that will help?

Okay here is an example, you are making a game and you want to have something do something only when they are touching some bad guy, but here is the problem: the sprite would not know if it was touching a clone and you used clones to create the bad guys. This is where the touching clone block would come in.
duckboycool
Scratcher
1000+ posts

Add detection for touching clones of self

The current block we have would work for that situation. Are you making sure you are setting it to the correct sprite?
calulord
Scratcher
100+ posts

Add detection for touching clones of self

duckboycool wrote:

The current block we have would work for that situation. Are you making sure you are setting it to the correct sprite?
That could work but there is no way for the clones to know if none of them are touching and to set it to false has fas as I can figure out.
duckboycool
Scratcher
1000+ posts

Add detection for touching clones of self

if <touching [bad guy v] ?> then
...
end
That would work. Is there something else I don't know about?
calulord
Scratcher
100+ posts

Add detection for touching clones of self

duckboycool wrote:

if <touching [bad guy v] ?> then
...
end
That would work. Is there something else I don't know about?
Okay thanks!
calulord
Scratcher
100+ posts

Add detection for touching clones of self

calulord wrote:

duckboycool wrote:

if <touching [bad guy v] ?> then
...
end
That would work. Is there something else I don't know about?
Okay thanks!

Wait I forgot, That only tell the clone that it's young something not what's it's touching.

Powered by DjangoBB