Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to change backdrop after a certain score is reached
- BeulaBetty
- Scratcher
2 posts
How to change backdrop after a certain score is reached
I am new to Scratch and learning to code the games in the tips section. In the Pong game, I would like to change the backdrop, angle and speed of the ball after the score for catching the ball reaches 10. I have found where the change backdrop block is but I don't know how to link the change to reaching a score of 10. Please help! Thank you
- SpaceDragon1
- New to Scratch
100+ posts
How to change backdrop after a certain score is reached
There are multiple ways to do this. I will show two ways here, the first is the one I would use.
Right after you change the score:
Right after you change the score:
if <(score) = [10]> then
switch backdrop to [ v]
end
when green flag clicked
forever
if <(score) = [10]> then
switch backdrop to [ v]
end
end
Last edited by SpaceDragon1 (Nov. 26, 2017 21:58:38)
- mstone326
- Scratcher
1000+ posts
How to change backdrop after a certain score is reached
There are multiple ways to do this. I will show two ways here, the first is the one I would use.
Right after you change the score:if <(score) = [10]> then
switch backdrop to [ v]
endwhen green flag clicked
forever
if <(score) = [10]> then
switch backdrop to [ v]
end
end
This issue with the above code is as long as it is level 10 it will continue to switch backdrops to whatever 30 times per second until it no longer = 10.
wait until blocks would be more efficient I think.
wait until <(score) > [9]>
switch backdrop to [backdrop2 v]
wait until <(score) > [19]>
switch backdrop to [backdrop3 v]
High School Athletic Director / Middle School Tech Teacher / High School Baseball Coach
Kung Fu by Nintendo 1984 - https://scratch.mit.edu/projects/369994801/
Taco Defense - Speed Typing - https://scratch.mit.edu/projects/316795450/
Halloween Boss Battle - Taking Back our Woods - https://scratch.mit.edu/projects/257155118/
Almost Pong - https://scratch.mit.edu/projects/656276979/
Studio - My Best Projects - https://scratch.mit.edu/studios/4125978/
Forum Help Project Examples - https://scratch.mit.edu/studios/4133335
- SpaceDragon1
- New to Scratch
100+ posts
How to change backdrop after a certain score is reached
To clarify, only the second piece of code will do that (that’s why I would not personally use it).There are multiple ways to do this. I will show two ways here, the first is the one I would use.
Right after you change the score:if <(score) = [10]> then
switch backdrop to [ v]
endwhen green flag clicked
forever
if <(score) = [10]> then
switch backdrop to [ v]
end
end
This issue with the above code is as long as it is level 10 it will continue to switch backdrops to whatever 30 times per second until it no longer = 10.
wait until blocks would be more efficient I think.wait until <(score) > [9]>
switch backdrop to [backdrop2 v]
wait until <(score) > [19]>
switch backdrop to [backdrop3 v]
The first piece of code will only check right after the score is changed, meaning that it will only change the background once.
- Scorched-Wolf
- Scratcher
9 posts
How to change backdrop after a certain score is reached
I have tried what you suggest and it works well, except the backdrop changes at scores 8 and 17, instead of 10 and 20, for some reason
- asivi
- Scratcher
1000+ posts
How to change backdrop after a certain score is reached
Hi, it is better to create your own topic explaining and sharing your project.
- PeytonB9823
- New to Scratch
1 post
How to change backdrop after a certain score is reached
It won't work at all
UGGGHHH
UGGGHHH
- deck26
- Scratcher
1000+ posts
How to change backdrop after a certain score is reached
Create your own topic and share the project. There's not much point to your post otherwise. It won't work at all
UGGGHHH
- TripleTrouble8642
- Scratcher
2 posts
How to change backdrop after a certain score is reached
There are multiple ways to do this. I will show two ways here, the first is the one I would use.
Right after you change the score:if <(score) = [10]> then
switch backdrop to [ v]
endwhen green flag clicked
forever
if <(score) = [10]> then
switch backdrop to [ v]
end
end
Thank You @SpaceDragon1 ! I appreciate you helping out in the community and especially helping me. Just saying a big thank you to everyone as well…
- Sboosh_Kaboosh
- Scratcher
100+ posts
How to change backdrop after a certain score is reached
if <[score] = [whatever]> then
switch backdrop to [Whatever v]
end
Helps?
Hi! I’m Sboosh_Kaboosh! If you need to ask any questions or just want someone to chat to… just go to my profile!
My most popular game: Dangerous Driving
Favourite game of mine: Badly Drawn Dangerous Driving
Favourite Block:
(variable)
- hunterbeau
- Scratcher
2 posts
How to change backdrop after a certain score is reached
thank you it worked
- Tomboysksksk
- Scratcher
2 posts
How to change backdrop after a certain score is reached
what if you want that when someone clicks something it changes to a different backdrop?
- thelion5000
- Scratcher
100+ posts
How to change backdrop after a certain score is reached
Create your own topic and share the project.
this could be me asking a question or me answering one, if i am answering a question then hope i helped and if i am asking one then hope somebody replies early. I will always try my best
- ScratchedAni
- New to Scratch
1 post
How to change backdrop after a certain score is reached
Thanks it helped
- TheMatrick
- Scratcher
3 posts
How to change backdrop after a certain score is reached
if <(☁ score) = [10]> then
switch backdrop to [ v]
end
[/scratchb[scratchblocks]
locks]
set [ Score] to [0]
[/scratchblocks]
- TheMatrick
- Scratcher
3 posts
How to change backdrop after a certain score is reached
if then score = 10
change backdrop next backdrop
set score to 0
change backdrop next backdrop
set score to 0
- Lily_E_Potter
- Scratcher
38 posts
How to change backdrop after a certain score is reached
switch backdrop to [the first backdrop]
if <score=10> then
switch backdrop to [ the second backdrop]
end
- Discussion Forums
- » Help with Scripts
- » How to change backdrop after a certain score is reached