Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Increasing Level Every Time Score Increases by 10
        ![[RSS Feed] [RSS Feed]](//cdn.scratch.mit.edu/scratchr2/static/__5b3e40ec58a840b41702360e9891321b__//djangobb_forum/img/feed-icon-small.png)  
- GoonsNCSU
- 
                             New Scratcher New Scratcher
2 posts
Increasing Level Every Time Score Increases by 10
I accidentally necroposted on someone else's thread (I apologize, not great for my first post here!) but was wondering if someone could help with the following:
I'd like my variable ‘level’ to increase by 1 every time my variable ‘score’ increases by 10. I've tried if score = 10 then change level by 1….but I know I can't do this in a forever loop.
Any thoughts?
Thanks so much!
                        
                        
                    I'd like my variable ‘level’ to increase by 1 every time my variable ‘score’ increases by 10. I've tried if score = 10 then change level by 1….but I know I can't do this in a forever loop.
Any thoughts?
Thanks so much!
- totalcode
- 
                             Scratcher Scratcher
9 posts
Increasing Level Every Time Score Increases by 10
when green flag clicked
forever
set ( requirement) to ((level) * (10))
if <(score) = ( requirement)> then
change [ level] by (1)
end
end
this should work
- deck26
- 
                             Scratcher Scratcher
1000+ posts
Increasing Level Every Time Score Increases by 10
If the score only changes in one place checking it as @asivi says is the best method.  
If the score may change in multiple places you'll need a separate loop but avoid unnecessarily resetting a variable as @totalcode shows.
In the case of a separate check I'd do
                        
                        
                    If the score may change in multiple places you'll need a separate loop but avoid unnecessarily resetting a variable as @totalcode shows.
In the case of a separate check I'd do
foreverYou could use equals rather than greater than if you know score only ever changes by 1 but the above is generally safer.
wait until <(score) > (((level) * [10]) - [1])>
change [level v] by [1]
any other code required to change level
end
- asivi
- 
                             Scratcher Scratcher
1000+ posts
Increasing Level Every Time Score Increases by 10
Well, in case you change score in multiple places as @deck26 commented you can have the script with the mod in just one place(no need of repeating it) and call it by bradcasting a message when it changes, so you can avoid race conditions that come up in case you change score very quickly and the project would be too busy(laggy perhaps).
                        
                        
                    - PCookie_
- 
                             Scratcher Scratcher
4 posts
Increasing Level Every Time Score Increases by 10
In my case, whenever the score increases by 10, I want my “coin” sprite to appear on the screen. I just don't know how to manage that.
                        
                        
                    - Morimop
- 
                             Scratcher Scratcher
1000+ posts
Increasing Level Every Time Score Increases by 10
In my case, whenever the score increases by 10, I want my “coin” sprite to appear on the screen. I just don't know how to manage that.Hello there! Sorry, but… You are necroposting.
If the topic has been inactive for a significant length of time, and the new post adds nothing to the topic, then the post can be considered a necropost. However, a post in a sticky or ITopic is not considered a necropost if it adds more useful information (these topics are kept at the top of the forum page anyway, so posting does not bump them). Necroposting on purpose is strongly discouraged, as it is unhelpful, clogging up the top of the forum with outdated and unneeded topics.
- PCookie_
- 
                             Scratcher Scratcher
4 posts
Increasing Level Every Time Score Increases by 10
when green flag clicked
forever
set ( requirement) to ((level) * (10))
if <(score) = ( requirement)> then
change [ level] by (1)
end
end
this should work
what does requirement mean?
- codeman1044
- 
                             Scratcher Scratcher
1000+ posts
Increasing Level Every Time Score Increases by 10
Please don't necropost. If you need help with something, then please create your own topic.
                        
                        
                    - arkanSkibbidob
- 
                             Scratcher Scratcher
1 post
Increasing Level Every Time Score Increases by 10
I am tyring to make a project
this is it
https://scratch.mit.edu/projects/896950552/editor
Im trying to shrink the code pls help
                        
                        
                    this is it
https://scratch.mit.edu/projects/896950552/editor
Im trying to shrink the code pls help

- existentialcrisises
- 
                             Scratcher Scratcher
100+ posts
Increasing Level Every Time Score Increases by 10
As Morimop and codeman1044 said, please don't necropost. This topic is around 6 years old. If you want to ask a question about your project, please create a new topic.
                        
                        
                    - Discussion Forums
- » Help with Scripts
- 
            » Increasing Level Every Time Score Increases by 10 ![[RSS Feed] [RSS Feed]](//cdn.scratch.mit.edu/scratchr2/static/__5b3e40ec58a840b41702360e9891321b__//djangobb_forum/img/feed-icon-small.png)  
 
            ![[RSS Feed] [RSS Feed]](http://cdn.scratch.mit.edu/scratchr2/static/__5b3e40ec58a840b41702360e9891321b__//djangobb_forum/img/feed-icon-small.png)






