Discuss Scratch

bolthyy
New Scratcher
4 posts

I can't get my score to increase by only one?

Looking for the counter to only go up by one when it touches the firepit, however, if you hold the sprite over the fire pit, it will just count up indefinitely.

i've tried playing around with the mouse down button and waiting and swapping around the orders of my script, but it just breaks it further and adds weird delays.

also, does the sound work for anyone else? its been bugging out for me and simply just not playing.

any help greatly appreciated.

https://scratch.mit.edu/projects/785181718
qwertyuiopbomb
Scratcher
23 posts

I can't get my score to increase by only one?

try this
when I start as a clone
forever
if <touching [ sprite v] ?> then
broadcast [ ded v] and wait
end
end

when I receive [ded v]
change [score v] by (1)
D-ScratchNinja
Scratcher
1000+ posts

I can't get my score to increase by only one?

It's because dragging the sprite is overriding the go-to-x-y block. The sprite jumps back to the starting point but then immediately gets dragged back. Notice how if you drag the sprite above the fire pit and then let it fall into it, you only get one point and then the sprite goes back to its starting point. You can probably fix this by only increasing the score only if the mouse button is not down.

For the sound, your sprite's volume is set to 0%, so that's why it won't play any sound. Just use the set-volume block to turn it up again.
bolthyy
New Scratcher
4 posts

I can't get my score to increase by only one?

qwertyuiopbomb wrote:

try this
when I start as a clone
forever
if <touching [ sprite v] ?> then
broadcast [ ded v] and wait
end
end

when I receive [ded v]
change [score v] by (1)

Thanks for the response

Unfortunately, it still has the same issue if I broadcast the score as it does if I just put the score in original script

and maybe im misunderstanding the last one, but I dont want the sprite to go towards my mouse
bolthyy
New Scratcher
4 posts

I can't get my score to increase by only one?

D-ScratchNinja wrote:

It's because dragging the sprite is overriding the go-to-x-y block. The sprite jumps back to the starting point but then immediately gets dragged back. Notice how if you drag the sprite above the fire pit and then let it fall into it, you only get one point and then the sprite goes back to its starting point. You can probably fix this by only increasing the score only if the mouse button is not down.

For the sound, your sprite's volume is set to 0%, so that's why it won't play any sound. Just use the set-volume block to turn it up again.


Thank you, that fixed the sound.

And the other part makes absolute sense, but how can I change it so that it only increases if the mouse button is not down? I've seen that suggestion in other threads but I can't find that function anywhere.
D-ScratchNinja
Scratcher
1000+ posts

I can't get my score to increase by only one?

bolthyy wrote:

Thank you, that fixed the sound.

And the other part makes absolute sense, but how can I change it so that it only increases if the mouse button is not down? I've seen that suggestion in other threads but I can't find that function anywhere.
Try this:
if <<touching [Fire Pit v]> and <not <mouse down?>>> then
...
end
bolthyy
New Scratcher
4 posts

I can't get my score to increase by only one?

D-ScratchNinja wrote:

bolthyy wrote:

Thank you, that fixed the sound.

And the other part makes absolute sense, but how can I change it so that it only increases if the mouse button is not down? I've seen that suggestion in other threads but I can't find that function anywhere.
Try this:
if <<touching [Fire Pit v]> and <not <mouse down?>>> then
...
end

Thank you, solved the problem!

Powered by DjangoBB