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

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

how to keep score?

when your making a game and you want to make it keep score of how many times it does something how can you?


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

Offline

 

#2 2011-08-14 21:22:34

Death_Wish
Scratcher
Registered: 2011-07-26
Posts: 1000+

Re: how to keep score?

babbet wrote:

when your making a game and you want to make it keep score of how many times it does something how can you?

You need to make a variable named Score. Then, put when green flag pressed, set (score) to 0. After that, put forever, if touching color red, change (score) by (1)**. After the variable block put Wait one second, that way it doesn't add 1 to the score every millisecond it touches the color (Let's say millisecond  tongue )

*(Depends what you want to happen to get the score-If you put here, touching color || it'd make it so that every time it touches red, it'd add a score by however you'd like-We'll see that now)

**The 1 is how much the score will change by. You could put 2, and every time it touches red, it'd add 2 to the score.

I'll make a block, even though I suck at these. And I don't necessarily know the code to end it. Is it [/blocks]?  tongue

<when green flag clicked>
<set{ score }to( 0 )>
<forever>
<if>
<touching color[ red ]>
<change{ score }by( 1 )>
<wait( 1 )secsc>
</if>
</forever>
[/blocks]
Gah, in the preview I realized /if and /forever don't do anything. Meh, at least I realized it was [ /blocks ]  tongue
If you didn't understand, I'll post a project with only that script. It'd be more clear  big_smile


With a straight flush.
http://4.bp.blogspot.com/-FlUhnzmIROE/TgtpjdJl4tI/AAAAAAAABCM/W19pvFTZFaU/s1600/save_the_world.png http://blocsonic.com/images/special/rip-stevejobs.jpg

Offline

 

#3 2011-08-15 17:00:53

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

Re: how to keep score?

i understand now. i didn't know how to use the variables but now i do


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

Offline

 

#4 2011-08-16 23:31:32

SheppardProductions
Scratcher
Registered: 2011-08-14
Posts: 100+

Re: how to keep score?

Make a variable called score. Program it so every time it does what you consider scoring you change score by 1. Simple. The 2 most important things in scratch are yourr broadcasts and variables. When most people start they think scratch sucks because they don't know what it can really do.

Offline

 

Board footer