Discuss Scratch

DrygzMissing
Scratcher
18 posts

How do I make a (When backdrop = #number) switch to a different background

To explain it more briefly, my code is not working and everytime I switch the background it will switch back. Even if I have the code set to repeat, forever or anything else.

Project: https://scratch.mit.edu/projects/840158939/

Last edited by DrygzMissing (April 24, 2023 18:39:20)

INSERT-USER_NAME
Scratcher
1000+ posts

How do I make a (When backdrop = #number) switch to a different background

You could use this block

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

It needs names instead of numbers though.
CoconutGator
Scratcher
1000+ posts

How do I make a (When backdrop = #number) switch to a different background

Is there a script that is constantly setting the background to something?
medians
Scratcher
1000+ posts

How do I make a (When backdrop = #number) switch to a different background

when gf clicked
forever
if <([backdrop # v] of [Stage v]) = [num]> then
switch backdrop to [another backdrop v]
end
end
If you are in the stage, you can just use the backdrop # reporter.

Last edited by medians (April 24, 2023 17:10:20)

Knightbot63
Scratcher
1000+ posts

How do I make a (When backdrop = #number) switch to a different background

Could you share the project link so we can see your code?
DrygzMissing
Scratcher
18 posts

How do I make a (When backdrop = #number) switch to a different background

Knightbot63 wrote:

Could you share the project link so we can see your code?
https://scratch.mit.edu/projects/840158939/ Here it is.
Knightbot63
Scratcher
1000+ posts

How do I make a (When backdrop = #number) switch to a different background

You could use
when green flag clicked
forever
if <(backdrop name) = [name you want]> then
switch backdrop to [whatever v]
end
end
The code in the backdrop doesn't have a forever loop so that's your problem with the code.
DrygzMissing
Scratcher
18 posts

How do I make a (When backdrop = #number) switch to a different background

What I meant to say to be more specific is, there is one group of backdrops that are one of set of animations and there is another one. I need the script to make it switch the backdrops and start another animation after I click a button. But the first set of animations are causing it to bug the first animation.
donotforgetmycode
Scratcher
1000+ posts

How do I make a (When backdrop = #number) switch to a different background

medians wrote:

If you are in the stage, you can just use the backdrop # reporter.
Bamboozled by 3.0!
(backdrop [name v] :: looks)
(backdrop [number v] :: looks) // these blocks exist in sprites, not just the stage
medians
Scratcher
1000+ posts

How do I make a (When backdrop = #number) switch to a different background

donotforgetmycode wrote:

medians wrote:

If you are in the stage, you can just use the backdrop # reporter.
Bamboozled by 3.0!
(backdrop [name v] :: looks)
(backdrop [number v] :: looks) // these blocks exist in sprites, not just the stage
oh my god


In 2.0 the backdrop name block was accessible to the stage and sprites, but the backdrop # block was only accessible to the stage and they were asking for a number.. which you could obtain in sprites through workarounds such as the sensing block but I wasn't sure if saying “Drag the backdrop # block from the stage on top of the sprites to copy it there” would confuse them.

Last edited by medians (April 24, 2023 22:11:56)

Powered by DjangoBB