Discuss Scratch

aartigandhale22
New Scratcher
5 posts

Selection of specific costume of sprite

Hello!
Is there any way to select specific costume of the sprite in Scratch to put it in conditions like { if touching… }. In dropdown list we can select sprites but I want to put condition for specific costume of sprite. Please help me.
asivi
Scratcher
1000+ posts

Selection of specific costume of sprite

if <> then //here you may put a condition from sensing blocks

end

The blocks below report "True" or "False" ::grey

<touching [ v] ?>
<touching color [#ff0088] ?>
<color [#00ff00] is touching [#0000ff] ?>
<mouse down?>

the others rounded blocks inside the sensing section::grey
may be used in conjunction with operator blocks::grey

(distance to [ v])
(answer)
(mouse x)
(mouse y)
(loudness)
(video [ v] on [ v])
(timer)
([ v] of [ v])
(current [ v])
(days since 2000)
(username)
So, you can do this:
when green flag clicked
forever

if <key [up arrow v] pressed?> then
switch costume to [up costume v]

end

end
or this other:
when green flag clicked
forever

if <(distance to [girlfriend v]) < [50]> then
switch costume to [smiling costume v]

end

end
aartigandhale22
New Scratcher
5 posts

Selection of specific costume of sprite

hey thanks for your reply. What I want is how can we select specific costume of sprite. for e.g. Suppose I have bubble as a sprite and red bubble, blue bubble, yellow bubble are its costumes. From drop down list with any condition I can select only bubble but what if I want to select Red or Yellow or Blue bubble? How can I do this without representing them as different sprites in my game or animation?
footsocktoe
Scratcher
1000+ posts

Selection of specific costume of sprite

aartigandhale22 wrote:

hey thanks for your reply. What I want is how can we select specific costume of sprite. for e.g. Suppose I have bubble as a sprite and red bubble, blue bubble, yellow bubble are its costumes. From drop down list with any condition I can select only bubble but what if I want to select Red or Yellow or Blue bubble? How can I do this without representing them as different sprites in my game or animation?

Do I understand you correctly? You want to do an IF- THEN where the condition is which costume the sprite is wearing?

If there are only 2 or 3 costumes then just do separate blocks…

if <(costume #) = [1 ]> then
do what you want done for that costume
end
if <(costume #) = [2 ]> then
do what you want done for that costume
end
if <(costume #) = [3 ]> then
do what you want done for that costume
end

If there are lots of costumes to check then you might want to take an approach that uses a list variable.
deck26
Scratcher
1000+ posts

Selection of specific costume of sprite

I suspect what you're looking for is

([costume # v] of [spritename v])
which (when used in an if block) will allow spriteB to behave differently according to the costume of spriteA. So check if you're touching and then, if you are, what the costume of the other sprite is or combine them in a single if.

Is that what you're asking?
aartigandhale22
New Scratcher
5 posts

Selection of specific costume of sprite

Thank you footsocktoe and deck26. You both are correct. Both the solutions are helpful for me.

Powered by DjangoBB