Discuss Scratch

TheBloxofKingLolol
Scratcher
9 posts

How Do I Change Sprite When Backdrop Changes?

Hello!

I'm experiencing a new scripting; changing sprites when backdrop changes.

Although it sounds easier, I tried doing;

when backdrop switches to [ v]
switch costume to [ v]

or

when backdrop switches to [ v]
forever
switch costume to [ v]
end

Apparently, they both don't work, so if you find out a solution, I'll be satisfied and credit you!
axisjack
Scratcher
100+ posts

How Do I Change Sprite When Backdrop Changes?

Can you share the project?
codeman1044
Scratcher
1000+ posts

How Do I Change Sprite When Backdrop Changes?

axisjack wrote:

Can you share the project?
Agreed.
Make sure that your sprite isn't hidden (look below the viewing window at the sprite's stats. Is the eye open or crossed over?)
TheBloxofKingLolol
Scratcher
9 posts

How Do I Change Sprite When Backdrop Changes?

Oh sorry

I meant this;

when backdrop switches to [ v]
switch costume to [ v]

AND

when backdrop switches to [ v]
switch costume to [ v]

I tried to make two, but they don't work.
P.S Is it okay sharing another project with the problem?
human-after-all
Scratcher
18 posts

How Do I Change Sprite When Backdrop Changes?

I'd just do:
when green flag clicked
forever
if <[backdrop] = [backdrop2]> then
set [backdrop2? v] to [1]
end
end

when green flag clicked
forever
if <(backdrop2?) = [1]> then
switch costume to [costume v]
end
end
FlashOfNeon
Scratcher
15 posts

How Do I Change Sprite When Backdrop Changes?

You are doing:
when backdrop switches to [Backdrop1 v]
switch costume to [... v]
Instead of that, I would do:
when gf clicked
forever
if <(backdrop name)=[Backdrop1]> then
switch costume to [... v]
end
end
This will keep the program running (because of the forever loop) and it should work.
deck26
Scratcher
1000+ posts

How Do I Change Sprite When Backdrop Changes?

FlashOfNeon wrote:

You are doing:
when backdrop switches to [Backdrop1 v]
switch costume to [... v]
Instead of that, I would do:
when gf clicked
forever
if <(backdrop name)=[Backdrop1]> then
switch costume to [... v]
end
end
This will keep the program running (because of the forever loop) and it should work.
Much better to use wait until blocks - wait until backdrop is right one, switch backdrop and wait until not the right one (still in a forever loop). Switching backdrop in a forever loop forces Scratch to refresh the screen when it may not otherwise be required.
TheBloxofKingLolol
Scratcher
9 posts

How Do I Change Sprite When Backdrop Changes?

deck26 wrote:

FlashOfNeon wrote:

You are doing:
when backdrop switches to [Backdrop1 v]
switch costume to [... v]
Instead of that, I would do:
when gf clicked
forever
if <(backdrop name)=[Backdrop1]> then
switch costume to [... v]
end
end
This will keep the program running (because of the forever loop) and it should work.
Much better to use wait until blocks - wait until backdrop is right one, switch backdrop and wait until not the right one (still in a forever loop). Switching backdrop in a forever loop forces Scratch to refresh the screen when it may not otherwise be required.
I am very confused on what your instruction is.

If possible, can you send an image of what it should correctly be?
codeman1044
Scratcher
1000+ posts

How Do I Change Sprite When Backdrop Changes?

deck26 is saying that your code should look like this:
when gf clicked
forever
wait until <(backdrop [name v]::looks)=[Backdrop1]>
switch costume to [ v]
wait until <not<(backdrop [name v]::looks)=[Backdrop1]>
switch costume to [ v]

Last edited by codeman1044 (June 17, 2019 21:33:21)

TheBloxofKingLolol
Scratcher
9 posts

How Do I Change Sprite When Backdrop Changes?

Thank all of you! Now I found out how to change sprite when backdrop changes too! I'll credit you!


Have a GREAT TIME!
Nal2009
Scratcher
1 post

How Do I Change Sprite When Backdrop Changes?

when backdrop switches to [ v]
show
switch costume to [ v]

Last edited by Nal2009 (Aug. 29, 2020 15:01:03)

Powered by DjangoBB