Discuss Scratch

Cute-eyes
Scratcher
1 post

Changing background when pressing a button

When my projects runs I have “switch backdrop to backdrop 1”. Later in the code I have “if key down arrow pressed then - switch backdrop to backdrop2” followed with more code on a new line. But when I run the project nothing happens when I press down. The rest of the code runs as normal.

What I have tried:
changing the key pressed from space to down arrow - no change
moving the rest of the code into the “if key down arrow pressed” line - now everything in the “if…” is not working

Can anybody help me please?
DaEpikDude
Scratcher
1000+ posts

Changing background when pressing a button

Either your first script is in a forever loop when it shouldn't be or your second isn't when it should be. If it's not it just checks once, it won't check again.
If you only want it to run once you can use “wait until”.
deck26
Scratcher
1000+ posts

Changing background when pressing a button

Sharing what you have saves us guessing.
scratchtwins-691
Scratcher
100+ posts

Changing background when pressing a button

Hi! Here are some things you need to check:

Is a When Green Flag Clicked block before your codes?
Did you put the codes into the backgrounds and not the sprites?
Did you put the first code into a Forever block? If yes, then remove the Forever block.

I hope this helped!

Last edited by scratchtwins-691 (Oct. 13, 2017 12:49:37)

HittmanAAlt
New Scratcher
2 posts

Changing background when pressing a button

Can you post the code for us to see, please?
BroOn4tn1t
Scratcher
39 posts

Changing background when pressing a button

im having this issue too
26afitzpatrick
New Scratcher
1 post

Changing background when pressing a button

whenclickedifthentouchingcolor?switchbackdropto
YA1050G
Scratcher
1 post

Changing background when pressing a button

When key pressed to switch backdropm

When (dropdown) key pressed:
Change backdrop to (backdrop name)

But if its when a sprite touches a colour or if a variable says a certain thing, heres how to do it:

When flag clicked:


The part inside the is the if then.
Inside the if then, if it is a variable, use the (blank)blank, usually says 50 when you place it but it can be edited)
Go to variables get a round block of the variable you want, place that in the first blank.
In the second blank, add what the variable should say to change the backdrop.

But if its a sprite touching a colour or anither sprite, add the touching (colour) block or the touching (sprite name) block

Hope this made sense.
NanoBug_
Scratcher
78 posts

Changing background when pressing a button

There is a solution!
repeat this code as many times you need to ask me if u need more details
whenKEYkeypressedswitchbackdroptoBACKDROP
Rexperseud
Scratcher
18 posts

Changing background when pressing a button

I don't need help making stuff but I DO need help with thinking of stuff to make

thinkWhat should I make?
GreenPaintNew
Scratcher
4 posts

Changing background when pressing a button

whenclickedswitchbackdropto

or

whenkeypressedswitchbackdropto

Just like that!

Last edited by GreenPaintNew (Oct. 29, 2023 02:50:37)

Asyadfghjkl
Scratcher
100+ posts

Changing background when pressing a button

YOU MUT BE PRESSING THE BUTTON WHEN THE IF RUNS
ELSE BACKDROP WILL NOT CHANGE

Last edited by Asyadfghjkl (Oct. 29, 2023 04:03:40)

TheGoldrex
Scratcher
1 post

Changing background when pressing a button

e
whenclickedsayFollow Me and give me ideas for scratch projects
definesaywhy cant i make my project change to my main menu when the red octagon is clicked?

Powered by DjangoBB