Discuss Scratch

Klinklang
Scratcher
14 posts

Detecting if touching a clone with a particular costume.

Is there a way to detect if the clone a sprite is touching is a particular costume. I have it to where touching a clone of a sprite kills you, but before it appears there is a warning sign. That sign is the same sprite, so touching it kills you. I tried looking at the wiki, but detecting clones doesn't help at all.
HawkHD21
Scratcher
5 posts

Detecting if touching a clone with a particular costume.

Yes there is. You have to set a variable that is set to what ever the costume is set to. Then you make an if statement when that sprite touches while that variable is set to one of the corresponding costumes it will do what you want it to.
Klinklang
Scratcher
14 posts

Detecting if touching a clone with a particular costume.

HawkHD21 wrote:

Yes there is. You have to set a variable that is set to what ever the costume is set to. Then you make an if statement when that sprite touches while that variable is set to one of the corresponding costumes it will do what you want it to.
Is it a local or global variable?
Klinklang
Scratcher
14 posts

Detecting if touching a clone with a particular costume.

HawkHD21 wrote:

Yes there is. You have to set a variable that is set to what ever the costume is set to. Then you make an if statement when that sprite touches while that variable is set to one of the corresponding costumes it will do what you want it to.
Also, could you make a project showing the script in action. I'd like to know what it looks like.
asivi
Scratcher
1000+ posts

Detecting if touching a clone with a particular costume.

Klinklang wrote:

HawkHD21 wrote:

Yes there is. You have to set a variable that is set to what ever the costume is set to. Then you make an if statement when that sprite touches while that variable is set to one of the corresponding costumes it will do what you want it to.
Also, could you make a project showing the script in action. I'd like to know what it looks like.
Please, Klinklang, share your project, I'd like to know what it looks like.

Last edited by asivi (Feb. 21, 2016 09:02:18)

mrbobbygreathead
Scratcher
1000+ posts

Detecting if touching a clone with a particular costume.

Klinklang wrote:

Is there a way to detect if the clone a sprite is touching is a particular costume. I have it to where touching a clone of a sprite kills you, but before it appears there is a warning sign. That sign is the same sprite, so touching it kills you. I tried looking at the wiki, but detecting clones doesn't help at all.
There is an easier way which does not take up variables:
<<touching [the sprite v] ?> and <([costume# v] of [the sprite v]) = [the costume you want]>>
Klinklang
Scratcher
14 posts

Detecting if touching a clone with a particular costume.

mrbobbygreathead wrote:

Klinklang wrote:

Is there a way to detect if the clone a sprite is touching is a particular costume. I have it to where touching a clone of a sprite kills you, but before it appears there is a warning sign. That sign is the same sprite, so touching it kills you. I tried looking at the wiki, but detecting clones doesn't help at all.
There is an easier way which does not take up variables:
<<touching [the sprite v] ?> and <([costume# v] of [the sprite v]) = [the costume you want]>>
I've tried that already. Basically if I touch any of the clones and just one of them is my desired costume, the character doesn't die.
deck26
Scratcher
1000+ posts

Detecting if touching a clone with a particular costume.

The costume# of the sprite from the sensing block will always be the sprite itself, not a clone. You need the clones to detect the touching since they can identify their own costume. Then the clone can broadcast to the player sprite and get it to do what you want.
leo1206
Scratcher
4 posts

Detecting if touching a clone with a particular costume.

thank all of you, my project works!
deck26
Scratcher
1000+ posts

Detecting if touching a clone with a particular costume.

leo1206 wrote:

thank all of you, my project works!
Please don't necropost just to thank people. All you do is move the topic back to the top of the forum.
Er7o7
Scratcher
1 post

Detecting if touching a clone with a particular costume.

so thats it

Last edited by Er7o7 (March 12, 2024 21:55:41)

Powered by DjangoBB