Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Variable Question
- Thepuzzlegame
- Scratcher
1000+ posts
Variable Question
Hello scratchers, I have a problem. In my game I want the players score to go up when they touch a present. So I made a script which would change the variable “score” by 1, when the present is touched by the player. However, if the player continues to touch the present then the score continues to increase by 1. Does anyone know how I can make it so that the players score will only go up by 1 point, once, when they touch the present?
Here's a link to a simplified version of the project so you can get a better idea of what I mean. http://scratch.mit.edu/projects/15626323/
Here's a link to a simplified version of the project so you can get a better idea of what I mean. http://scratch.mit.edu/projects/15626323/
hi!
- Thepuzzlegame
- Scratcher
1000+ posts
Variable Question
Thanks, but for this project I want the players score to go up when the player they are controlling with the arrow keys touches the present. Not just when the mouse touches the present.if <touching [mouse pointer v]?>
change [score v] by (1)
wait until <not <touching [mouse pointer v]?>>
end
//or if by "touch" you meant mouse click
when this sprite clicked
change [score v] by (1)
hi!
- Thepuzzlegame
- Scratcher
1000+ posts
Variable Question
I was able to replace “mouse pointer” with the name of the player character and it works now. Thank you!
hi!
- Discussion Forums
- » Help with Scripts
- » Variable Question