Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to End the Game After Reaching a Certain Score
- meridasbow
-
New Scratcher
2 posts
How to End the Game After Reaching a Certain Score
I'm using Scratch to make a game for class, where you get points for clicking certain sprites and lose points for clicking other sprites. I want to have the game end when the player gets 10 points, but I don't know how.
On a side note, how do I resize a sprite to make it smaller?
On a side note, how do I resize a sprite to make it smaller?
- crisostimo
-
Scratcher
500+ posts
How to End the Game After Reaching a Certain Score
Resize a sprite with:
Some people will tell you to use a forever block to answer your first question. I personally prefer to make a broadcast immediately following any time where you change the score then run some code to check the score:
set size to (50) %
Some people will tell you to use a forever block to answer your first question. I personally prefer to make a broadcast immediately following any time where you change the score then run some code to check the score:
change (score) by (1)
broadcast [Check Win v]
when I receive [Check Win v]
if ((score) > (9))
do the right thing to end the game
- meridasbow
-
New Scratcher
2 posts
How to End the Game After Reaching a Certain Score
Resize a sprite with:Thank you so much!! I'll credit you for your help when I finish the game.set size to (50) %
Some people will tell you to use a forever block to answer your first question. I personally prefer to make a broadcast immediately following any time where you change the score then run some code to check the score:change (score) by (1)
broadcast [Check Win v]
when I receive [Check Win v]
if ((score) > (9))
do the right thing to end the game
- MysticPuma1886
-
Scratcher
3 posts
How to End the Game After Reaching a Certain Score
So you need to use the end script for this, it would look like this.
if <Score=Winning Score> then
stop [all v]
end
- FiveCubed
-
Scratcher
100+ posts
How to End the Game After Reaching a Certain Score
But how do you get those red blocks then
Haha they're just a scratchblocks bug. It should look like this:
if <(score) = (winning score)> then
stop [all v]
end
- PokemonBFFS16
-
Scratcher
13 posts
How to End the Game After Reaching a Certain Score
I'm using Scratch to make a game for class, where you get points for clicking certain sprites and lose points for clicking other sprites. I want to have the game end when the player gets 10 points, but I don't know how.
On a side note, how do I resize a sprite to make it smaller?
Well you will need to make a varible. And when you get points put change points bby 1. The script is like this.
forever
if <[(points)] = [10]> then
stop [all v]
end
end
and to resize it do this but inside put your size
set size to () %
change size by ()
- furrypig
-
Scratcher
100+ posts
How to End the Game After Reaching a Certain Score
when green flag clicked
set [score v] to (0)
wait until <<(score) = (10)> or <(Score) > (10)>>
broadcast [game done v] //add a "when I recieve [game done]" in other sprites and below it add scripts for what the sprite should do at the end.
- really_dani1
-
New Scratcher
2 posts
How to End the Game After Reaching a Certain Score
where do you put them tho
- TomasDev
-
Scratcher
100+ posts
How to End the Game After Reaching a Certain Score
I'm using Scratch to make a game for class, where you get points for clicking certain sprites and lose points for clicking other sprites. I want to have the game end when the player gets 10 points, but I don't know how.More easy this…
On a side note, how do I resize a sprite to make it smaller?
Here's the step if you want only a background saying You win!
when green flag clicked
forever
if <(score) = [10]> then
play sound [youwinsound v]
switch backdrop to [youwinbackdrop v]
stop [all v]
end
end
And for a message
when green flag clicked
forever
if <(score) = [10]> then
say [You win!] for (2) secs
stop [all v]
end
end
- deck26
-
Scratcher
1000+ posts
How to End the Game After Reaching a Certain Score
Can we please stop necroposting on this topic. The red blocks don't exist - in Scratchblock mode the forum shows things it doesn't understand as if they are red blocks. They're often used in the forum to indicate a place where you add your own code if necessary.
Start your own topic if you have a question - you can still refer to this topic if required.
Start your own topic if you have a question - you can still refer to this topic if required.
- DJSvideogamer229
-
Scratcher
85 posts
How to End the Game After Reaching a Certain Score
That's a really easy question to answer:
when I receive [ Ending]
if <(score) = (amount of points needed)> then
broadcast [good ending! ]
Last edited by DJSvideogamer229 (June 5, 2018 21:05:56)
- Discussion Forums
- » Help with Scripts
-
» How to End the Game After Reaching a Certain Score