Discuss Scratch

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?
crisostimo
Scratcher
500+ posts

How to End the Game After Reaching a Certain Score

Resize a sprite with:

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

crisostimo wrote:

Resize a sprite with:

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
Thank you so much!! I'll credit you for your help when I finish 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
Thm14
Scratcher
1 post

How to End the Game After Reaching a Certain Score

But how do you get those red blocks then
FiveCubed
Scratcher
100+ posts

How to End the Game After Reaching a Certain Score

Thm14 wrote:

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

meridasbow wrote:

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.
ShawnAguilar
New Scratcher
1 post

How to End the Game After Reaching a Certain Score

joshieman06
Scratcher
5 posts

How to End the Game After Reaching a Certain Score

Ok
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

meridasbow wrote:

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?
More easy this…
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
TikiMan20
Scratcher
1 post

How to End the Game After Reaching a Certain Score

dewfcsaef
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.
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)

badatprogrammingibe
Scratcher
500+ posts

How to End the Game After Reaching a Certain Score

deck26 wrote:

badatprogrammingibe wrote:

deck26 wrote:

IchySpiderPiG24 wrote:

IchySpiderPiG24 RULES
No, you're spamming.
It's not really spamming if it's just a single sentence, and a single post.
Anything irrelevant in a forum post is considered spamming.
That would make this discussion spamming, because in its essence it's irrelevant to the topic of this topic.
deck26
Scratcher
1000+ posts

How to End the Game After Reaching a Certain Score

badatprogrammingibe wrote:

deck26 wrote:

badatprogrammingibe wrote:

deck26 wrote:

IchySpiderPiG24 wrote:

IchySpiderPiG24 RULES
No, you're spamming.
It's not really spamming if it's just a single sentence, and a single post.
Anything irrelevant in a forum post is considered spamming.
That would make this discussion spamming, because in its essence it's irrelevant to the topic of this topic.
Correct but would you rather I'd ignored you? We can stop it now.

Powered by DjangoBB