Discuss Scratch

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:
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

SpaceDragon1 wrote:

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]
end
when 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]

Technology Director / Teacher Grades K-8 / 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/
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

mstone326 wrote:

SpaceDragon1 wrote:

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]
end
when 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]
To clarify, only the second piece of code will do that (that’s why I would not personally use it).
The first piece of code will only check right after the score is changed, meaning that it will only change the background once.
BeulaBetty
Scratcher
2 posts

How to change backdrop after a certain score is reached

Thank you!
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
deck26
Scratcher
1000+ posts

How to change backdrop after a certain score is reached

PeytonB9823 wrote:

It won't work at all



UGGGHHH
Create your own topic and share the project. There's not much point to your post otherwise.
TripleTrouble8642
Scratcher
2 posts

How to change backdrop after a certain score is reached

SpaceDragon1 wrote:

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]
end
when 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…
So-fetch
New to Scratch
1 post

How to change backdrop after a certain score is reached

Thanks
Sboosh_Kaboosh
Scratcher
78 posts

How to change backdrop after a certain score is reached

if <[score] = [whatever]> then
switch backdrop to [Whatever v]
end


Helps?

Hi! I like to code and to play games! I have some coding experience and I love making games!
I hope you consider following! Thanks for reading this post.
hunterbeau
Scratcher
2 posts

How to change backdrop after a certain score is reached

thank you it worked
hunterbeau
Scratcher
2 posts

How to change backdrop after a certain score is reached

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
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

Lily_E_Potter

uh. hi. I am learning BB Code

Powered by DjangoBB

Standard | Mobile