Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How can I score only one point per sprite?
- AVETNS
-
2 posts
How can I score only one point per sprite?
Hi. I'm a complete newbie and am working on the main scripts to run a game in a primary school, which will drive awareness for environmentally friendly issues. Thanks to this wiki and various videos I'm making good progress. However, I'm stuck…
http://scratch.mit.edu/projects/47848752/#player
I have set up a scoring system to enable the player to earn 1 point by clicking on a relevant other sprite, once they are touching it. That's working fine but I wish to prevent people from earning additional points by simply clicking on the same sprite again. Only one point per clicked sprite should be allowed. I've tried adding a ‘stop script’ at the end of the script but that hasn't done the job.
I'm using the windowsprite as my test sprite. Once the scripting is sorted, students of mind will design and draw additional sprites.
I would be very, very grateful if anybody could suggest a fix, please?
Thanks,
Mark
http://scratch.mit.edu/projects/47848752/#player
I have set up a scoring system to enable the player to earn 1 point by clicking on a relevant other sprite, once they are touching it. That's working fine but I wish to prevent people from earning additional points by simply clicking on the same sprite again. Only one point per clicked sprite should be allowed. I've tried adding a ‘stop script’ at the end of the script but that hasn't done the job.
I'm using the windowsprite as my test sprite. Once the scripting is sorted, students of mind will design and draw additional sprites.
I would be very, very grateful if anybody could suggest a fix, please?
Thanks,
Mark
- googlegeekgirl
-
37 posts
How can I score only one point per sprite?
Try using cloud data. I've seen voting games where people use those. With that, a person can only vote once. Try incorporating that into your project.
- googlegeekgirl
-
37 posts
How can I score only one point per sprite?
However, if you are new on scratch unfortunately you cannot use cloud data.
- Arthurtilly
-
1000+ posts
How can I score only one point per sprite?
Make it so the sprite hides after it is clicked. Or, use this:
when this sprite clicked
if <[username list v] contains (username)> then
say [You have already voted!]
else
change [votes v] by (1)
add (username) to [ username list v]
end
Last edited by Arthurtilly (Feb. 18, 2015 03:45:18)
- lbruns
-
500+ posts
How can I score only one point per sprite?
Make it so the sprite hides after it is clicked. Or, use this:when this sprite clicked
if <[username list v] contains (username)> then
say [You have already voted!]
else
change [votes v] by (1)
add (username) to [ username list v]
end
This would not work.
Sadly since your a “New Scratcher” you can't use something called cloud variables (Store Online Data), but if you want maybe a solution you could ask someone on the “Request” forum that has the scratcher status to make this project for you just have them remix the project and add cloud data to the variable you want to keep track of. Now an answer to your original question you could use a variable and make a script like this:
when this sprite clicked
if <(i) = [0 ]> then
change [Amount v] by (1)
end
set [i v] to [1 ]
If you have any questions feel free to ask!
- deck26
-
1000+ posts
How can I score only one point per sprite?
I think we might be over-complicating things here.
You're new to Scratch so can't use cloud variables so you can't currently have a solution where if a particular user runs your project more than once it will remember what they clicked previously.
However, if what you want is just to know whether the sprite has been clicked in this single run of the project then that is easy. For each sprite have a local variable ‘hasbeenclicked’ and set it to 0 in a green flag script. Then when you click the sprite
You're new to Scratch so can't use cloud variables so you can't currently have a solution where if a particular user runs your project more than once it will remember what they clicked previously.
However, if what you want is just to know whether the sprite has been clicked in this single run of the project then that is easy. For each sprite have a local variable ‘hasbeenclicked’ and set it to 0 in a green flag script. Then when you click the sprite
if <(hasbeenclicked) = [0 ]> then
set [hasbeenclicked v] to [ 1]
whatever else you want to do when sprite clicked first time
else
say [You've already clicked me] for (2) secs
end
- AVETNS
-
2 posts
How can I score only one point per sprite?
Hi googlegeekgirl, Arthurtilly, Ibruns and Deck 26,
Thank you all very, very much for taking the time to respond. I'd heard that Scratch was great and I've been realizing over the last week or two that it surely is. However, to get such support from (presumably unpaid, voluntary) Scratchers to help me out when I got stuck makes the overall Scratch experience legendary! I really appreciate it. I look forward to introducing it to some of the kids I work with in primary school.
Anyway, your advice worked. I used deck26's code, which I see was an incremental improvement from each of the previous suggestions. Looks like good teamwork, of a sort!
Thanks v much
Mark
Thank you all very, very much for taking the time to respond. I'd heard that Scratch was great and I've been realizing over the last week or two that it surely is. However, to get such support from (presumably unpaid, voluntary) Scratchers to help me out when I got stuck makes the overall Scratch experience legendary! I really appreciate it. I look forward to introducing it to some of the kids I work with in primary school.
Anyway, your advice worked. I used deck26's code, which I see was an incremental improvement from each of the previous suggestions. Looks like good teamwork, of a sort!
Thanks v much
Mark
- peekaboo3
-
39 posts
How can I score only one point per sprite?
it's easy
<<touching [mouse pointer v] ?> and <mouse down?>>
Last edited by peekaboo3 (May 29, 2015 10:31:44)
- Great-ball
-
3 posts
How can I score only one point per sprite?
none of these are helpful sorry

- deck26
-
1000+ posts
How can I score only one point per sprite?
Please don't necropost; create your own new topic, explain what you're trying to do and share the project. none of these are helpful sorry
- nflfan15
-
0 posts
How can I score only one point per sprite?
I AM MAKING BASKETBALL GAME. PLAYER BLUE (OFFENCE) CAN'T GET POINTS, BUT PLAYER RED (DEFENCE) CAN (GETS 1 POINT EVERY 1/2 SECOND).
- Griffpatch_fan139
-
1 post
How can I score only one point per sprite?
Hey! How do you make a one point per second system? I am making a cool clicker game and when you click on a power up it needs to give one point per second. I'm not sure, is it the “timer” block? Some help would be awesome!
Thanks!
Thanks!
- deck26
-
1000+ posts
How can I score only one point per sprite?
Please don't ask for help by posting at the end of an old topic. Create your own new topic. Hey! How do you make a one point per second system? I am making a cool clicker game and when you click on a power up it needs to give one point per second. I'm not sure, is it the “timer” block? Some help would be awesome!
Thanks!
- Discussion Forums
- » Help with Scripts
-
» How can I score only one point per sprite?