Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How do I get "Lives" to increase by 5 anytime "Score" gets to specific numbers.
- MurphyD50
-
New Scratcher
13 posts
How do I get "Lives" to increase by 5 anytime "Score" gets to specific numbers.
Hello, I am currently working on a colour guessing game which has a SCORE and LIVE variable.
The SCORE records the progression of the player after every gain - i.e The SCORE starts at 0 and anytime a player guesses right the SCORE increases by 1.
The LIVE provides the number of chances available after an incorrect guess - i.e There are 5 lives provided by “LIVE” and it reduces by 1 anytime an incorrect guess is made.
Now, here is the deal.
I want LIVE to increase by 5 anytime SCORE gets to a multiple of 10 (10, 20, 30, 40, 50, 60, 70, 80, e.t.c.).
Thanks.
The SCORE records the progression of the player after every gain - i.e The SCORE starts at 0 and anytime a player guesses right the SCORE increases by 1.
The LIVE provides the number of chances available after an incorrect guess - i.e There are 5 lives provided by “LIVE” and it reduces by 1 anytime an incorrect guess is made.
Now, here is the deal.
I want LIVE to increase by 5 anytime SCORE gets to a multiple of 10 (10, 20, 30, 40, 50, 60, 70, 80, e.t.c.).
Thanks.
- MookyE
-
Scratcher
100+ posts
How do I get "Lives" to increase by 5 anytime "Score" gets to specific numbers.
Make a new variable. Set the variable to 10 when the game starts. Wait until score=New var; then change lives by 5, change var by 10. Repeat.
- igwano1
-
Scratcher
22 posts
How do I get "Lives" to increase by 5 anytime "Score" gets to specific numbers.
Maybe
when green flag clicked
set [ counter] to [0]
forever
change [ counter] by (1)
if <(☁ score) = ((counter) * (10))> then
change [ ] Livesby (5)
end
if <[counter] = [100]> then
set [ counter] to [0]
end
end
- igwano1
-
Scratcher
22 posts
How do I get "Lives" to increase by 5 anytime "Score" gets to specific numbers.
Maybewhen green flag clickedset [ counter] to [0]
forever
change [ counter] by (1)
if <(☁ score) = ((counter) * (10))> then
change [ ] Livesby (5)
end
if <[counter] = [100]> then
set [ counter] to [0]
end
end
Quite a complicated way but could work
- igwano1
-
Scratcher
22 posts
How do I get "Lives" to increase by 5 anytime "Score" gets to specific numbers.
Make a new variable. Set the variable to 10 when the game starts. Wait until score=New var; then change lives by 5, change var by 10. Repeat.
Yea that's way better than my way
- NormalMaker
-
Scratcher
500+ posts
How do I get "Lives" to increase by 5 anytime "Score" gets to specific numbers.
when green flag clicked
forever
wait until <<not <((Score) / (10)) contains (.) :: operators>> and <not<(Score) = (0)>>>
change [Lives v] by (5)
end
Last edited by NormalMaker (Nov. 25, 2021 18:10:02)
- IndexErrorException
-
Scratcher
500+ posts
How do I get "Lives" to increase by 5 anytime "Score" gets to specific numbers.
Here is a simple way that is also the proper way to do it:


- mjccodes
-
Scratcher
5 posts
How do I get "Lives" to increase by 5 anytime "Score" gets to specific numbers.
when green flag clicked
forever
if <( score) = [chosen number]> then
change [lives v] by (5)
end
end
Last edited by mjccodes (Nov. 25, 2021 21:07:14)
- MurphyD50
-
New Scratcher
13 posts
How do I get "Lives" to increase by 5 anytime "Score" gets to specific numbers.
Make a new variable. Set the variable to 10 when the game starts. Wait until score=New var; then change lives by 5, change var by 10. Repeat.
Fantastic explanation.
Clarity 100%.
Worked perfectly, thanks.
- dave-alt-4
-
Scratcher
1000+ posts
How do I get "Lives" to increase by 5 anytime "Score" gets to specific numbers.
forever
if <not <(Score)< [15]>> then
change [live] by [5]
end
end
- Discussion Forums
- » Help with Scripts
-
» How do I get "Lives" to increase by 5 anytime "Score" gets to specific numbers.






