I'm creating a shooter style game where you're on safari and shoot various animals. I have a sight sprite that I've attached to the mouse pointer that plays a noise when clicked. I also have it set up so that when one of the animals is clicked, the sight sprite changes costume to be a blood spatter sprite and then back again.
I have a variable set for score, and for each of the animal sprites a script that has "when x animal clicked increase score by 1" but the score never changes.
I did an experiment where I just put a sprite with no other scripts other than the "when x animal clicked increase score by 1" and it worked until all the scripts were run together by clicking the green flag, after which it stopped working.
Can anyone help me out please?
Offline
are you using set varable?
Offline
Hey guys, I've uploaded what I have so far. Could someone maybe take a peep at it and see if they can figure out the scoring issue?
http://scratch.mit.edu/projects/kgreenbaum/2895651
Thanks!
Offline
I checked it and figured out what was wrong. To fix it replace
when [object v] clicked change [score v] by (1)with
when gf clicked forever if <<mouse down?> and <touching [mouse-pointer v]?>> change [score v] by (1)That should fix it.
Offline
Hey shpeters, thanks so much for this. I just put it in tried it out, but now when I click on the buffalo once, I get weird high numbers like 3, and then when i click again it jumps to 8...
Offline
kgreenbaum wrote:
Hey shpeters, thanks so much for this. I just put it in tried it out, but now when I click on the buffalo once, I get weird high numbers like 3, and then when i click again it jumps to 8...
Well then try editing your code so that it looks like this:
when gf clicked forever if <mouse down?> if <touching [mouse-pointer v]?>//* change [score v] by (1) end wait until <not (mouse down?)>//* end* - I added this in to make is so that you can't click once and move the mouse around to shoot multiple animals.
Last edited by ErnieParke (2012-11-09 16:17:12)
Offline
kgreenbaum wrote:
Hey shpeters, thanks so much for this. I just put it in tried it out, but now when I click on the buffalo once, I get weird high numbers like 3, and then when i click again it jumps to 8...
Sorry, I forgot to add the cool down. What is happening is the score is increasing because you are holding the shoot down for a few second. Here is the fixed version:
when gf clicked forever if <<mouse down?> and <touching [mouse-pointer v]?>> change [score v] by (1) wait (1) secs
Offline
Perfect thanks so much guys!!
Offline