This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-08-14 19:43:36

babbet
Scratcher
Registered: 2011-07-23
Posts: 100+

how can you keep score?

if your making a game and you want to have the sprite keep score of how many times it did something, how could you???


https://lh3.googleusercontent.com/-SBVvDiIX0PY/Tm6OBd27mnI/AAAAAAAABR4/b--gXKoPlkU/babbet400x150.jpg

Offline

 

#2 2011-08-14 19:44:52

ImagineIt
Scratcher
Registered: 2011-02-28
Posts: 1000+

Re: how can you keep score?

You can use variables and once the script finishes you can change it by 1.

Offline

 

#3 2011-08-17 06:37:32

LFCm4d227
New Scratcher
Registered: 2011-08-03
Posts: 16

Re: how can you keep score?

Create a variable called score (or whatever you want to call it), and then whenever whatever you want to make the score go up happens, change the score variable by 1.

So if you wanted to make it so that if the main sprite touched a coin then the score when up by one, your script would look like this:

when green flag clicked
forever if    touching color gold
change variable score by 1

And also make sure you have a script on the coin making it hide when it touches the main character.

Offline

 

#4 2011-08-17 07:06:01

DigiTechs
Scratcher
Registered: 2011-04-30
Posts: 500+

Re: how can you keep score?

LFCm4d227 wrote:

Create a variable called score (or whatever you want to call it), and then whenever whatever you want to make the score go up happens, change the score variable by 1.

So if you wanted to make it so that if the main sprite touched a coin then the score when up by one, your script would look like this:

when green flag clicked
forever if    touching color gold
change variable score by 1

And also make sure you have a script on the coin making it hide when it touches the main character.

you can change touching colour for touching[coin v] or whatever you would have the coin sprite named.


I'm back.
Maybe.

Offline

 

#5 2011-08-18 05:03:10

LFCm4d227
New Scratcher
Registered: 2011-08-03
Posts: 16

Re: how can you keep score?

DigiTechs wrote:

LFCm4d227 wrote:

Create a variable called score (or whatever you want to call it), and then whenever whatever you want to make the score go up happens, change the score variable by 1.

So if you wanted to make it so that if the main sprite touched a coin then the score when up by one, your script would look like this:

when green flag clicked
forever if    touching color gold
change variable score by 1

And also make sure you have a script on the coin making it hide when it touches the main character.

you can change touching colour for touching[coin v] or whatever you would have the coin sprite named.

Yes, but say you had over 100 coins, that would mean either a lot of scripts or a lot of <<  <or>  >>s!

Offline

 

#6 2011-08-18 14:07:36

technomaniac
Scratcher
Registered: 2011-08-15
Posts: 94

Re: how can you keep score?

<when green flag clicked>
<forever if> (situation)
<change{ score }by(any number)

Offline

 

#7 2011-08-18 15:11:41

ImagineIt
Scratcher
Registered: 2011-02-28
Posts: 1000+

Re: how can you keep score?

LFCm4d227 wrote:

DigiTechs wrote:

LFCm4d227 wrote:

Create a variable called score (or whatever you want to call it), and then whenever whatever you want to make the score go up happens, change the score variable by 1.

So if you wanted to make it so that if the main sprite touched a coin then the score when up by one, your script would look like this:

when green flag clicked
forever if    touching color gold
change variable score by 1

And also make sure you have a script on the coin making it hide when it touches the main character.

you can change touching colour for touching[coin v] or whatever you would have the coin sprite named.

Yes, but say you had over 100 coins, that would mean either a lot of scripts or a lot of <<  <or>  >>s!

No! You could make a variable called i and change it by 1 until it reaches the last coin.

Offline

 

#8 2011-08-19 09:24:28

fuzzwuzz21
Scratcher
Registered: 2011-07-06
Posts: 15

Re: how can you keep score?

create a veribale and then use <change{ variable }by(
and <set{variable  }to(


SOPA and PIPA are dead. Next victim: ACTA.
united we stand, divided we fall. WE are the internet.                                  Spread the word.

Offline

 

#9 2011-08-19 09:28:11

fuzzwuzz21
Scratcher
Registered: 2011-07-06
Posts: 15

Re: how can you keep score?

errm just use change variable by ()


SOPA and PIPA are dead. Next victim: ACTA.
united we stand, divided we fall. WE are the internet.                                  Spread the word.

Offline

 

Board footer