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 )
*(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]?
<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 ]
If you didn't understand, I'll post a project with only that script. It'd be more clear
Offline
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