Discuss Scratch

edonald
New Scratcher
4 posts

Score counter not working

I've added a score counting script but it's not working. The problem is that the score does not increase. What I want it to do is increase by 1 each time the main sprite touches various other sprites. Any ideas? Thanks.
cooking101
Scratcher
65 posts

Score counter not working

Try this:
whenclickedforeveriftouching?thenchangeby1
deck26
Scratcher
1000+ posts

Score counter not working

Sharing the project will make it easier to help.
scratchinghead
Scratcher
1000+ posts

Score counter not working

deck26 wrote:

Sharing the project will make it easier to help.
Yup.
edonald
New Scratcher
4 posts

Score counter not working

Hi, that's the script I've used. I've shared it, it's called Save the unicorn. The aim is for the cat to dodge the ghoul and collect the unicorns. As each unicorn is collected I want the score to increase by 1.
pencil2paper
Scratcher
1 post

Score counter not working

edonald wrote:

Hi, that's the script I've used. I've shared it, it's called Save the unicorn. The aim is for the cat to dodge the ghoul and collect the unicorns. As each unicorn is collected I want the score to increase by 1.

What @cooking101 said:

whenclickedforeveriftouchingunicorn?thenchangescoreby1

Does this work? Make sure to use the forever block or it won't work.
deck26
Scratcher
1000+ posts

Score counter not working

Set Score to 0 in one green flag script - no need to do it multiple times.

Most of your ‘if touching’ scripts are run when the green flag is clicked and then are finished straight away as you don't have a forever loop around them.
deck26
Scratcher
1000+ posts

Score counter not working

In at least one of the unicorns you have scripts telling it to hide when it touches the cat as well as telling it to change the score. You do have the forever loops in those scripts but you should combine into one script so the hide and score change are both in the same script.That would help reduce the number of scripts and make it easier to understand the project.

If the unicorns are detecting when they touch the cat you don't need the scripts getting the cat to do the same.

edonald
New Scratcher
4 posts

Score counter not working

Thanks for your input. Ok so I've made those changes. Now it works for unicorn 2 but none of the others. Also unicorn 2 no longer hides but the rest still do.
deck26
Scratcher
1000+ posts

Score counter not working

In unicorn2 you have one forever loop inside another - never a good idea! You want one forever loop, one ‘if touching’ block and then do what you want when touching. Same for the others - one forever loop, one ‘if touching’. You have two ‘if touching’ blocks so you hide and then try to see if it is touching something else but a hidden sprite won't detect that it is touching a visible sprite.
edonald
New Scratcher
4 posts

Score counter not working

Perfect! Sorted now, thanks for your help.
Troopy
New Scratcher
1 post

Score counter not working

Score won't go up above 0. I've shared it. It's called Star Wars attempt 5 prototype I hope this works on scratch variables work on lives but not score???????
anvanlaer
Scratcher
67 posts

Score counter not working

Troopy wrote:

Score won't go up above 0. I've shared it. It's called Star Wars attempt 5 prototype I hope this works on scratch variables work on lives but not score???????
This is an old thread. Better is to make your own post so we can help you.
coldmonster
New Scratcher
1 post

Score counter not working

I have created ‘catch the fruit game’ but when the fruit touches the basket the score is increasing randomly
deck26
Scratcher
1000+ posts

Score counter not working

coldmonster wrote:

I have created ‘catch the fruit game’ but when the fruit touches the basket the score is increasing randomly
Please create your own topic rather than necroposting.

Check your costumes - do the displayed sizes match what you expect? Are you changing score in a loop so it happens multiple times when you only want it to happen once?
adsuri
Scratcher
1000+ posts

Score counter not working

whenclickedforeveriftouchingunicorn?thenchangescoreby1
Something like that.

Last edited by adsuri (June 25, 2018 21:20:12)

deck26
Scratcher
1000+ posts

Score counter not working

adsuri wrote:

whenclickedforeveriftouchingunicorn?thenchangescoreby1
Something like that.
Anything in this topic to do with unicorns is 3 years old, please check date before posting.
adsuri
Scratcher
1000+ posts

Score counter not working

deck26 wrote:

adsuri wrote:

whenclickedforeveriftouchingunicorn?thenchangescoreby1
Something like that.
Anything in this topic to do with unicorns is 3 years old, please check date before posting.
Oh oops sorry.
MReidAIG
New Scratcher
1 post

Score counter not working

I cant get my score to go up without going insanely rapid, or duplicating, this is the code:
If <touching paddle 1/2>, then:
Change score by (Score+1)
DrGaming_92Games
Scratcher
100+ posts

Score counter not working

MReidAIG wrote:

I cant get my score to go up without going insanely rapid, or duplicating, this is the code:
If <touching paddle 1/2>, then:
Change score by (Score+1)

Please make your own topic rather than necroposting

Powered by DjangoBB