Discuss Scratch

BestStudent01
Scratcher
11 posts

How do you fix this bug with the candy

So basically I am currently working on a game called “Candy Trade Simulator” it is basically the Fidget Toy Simulator game except with candy. So far I only added sour patch kids, but I have noticed a bug.
So when you have 1 sour patch kid in your inventory and you click on it, it will add a sour patch kid to the table. But if you have 2 sour patch kids and you try to add them both, when you click once it adds 1, like normal, but once you click it again, this time it adds 2. (So there is 3 sour patch kids on the table instead of 2)
How can I fix the bug? Here is the link: https://scratch-mit-edu.ezproxy.canberra.edu.au/projects/1083631291/
Thanks
mmhmBeans
Scratcher
500+ posts

How do you fix this bug with the candy

The clones are also receiving the broadcast and cloning themselves. You can use a this-sprite-only variable to tell if the receiver is a clone:

when green flag clicked
set [clone v] to (0)
when I start as a clone
set [clone v] to (1)
when I receive [Add Sour Patch Kid v]
if <(clone) > (0)> then
stop [this script v]
end
...

Hello, fellow human! I am also a human. I like to do human things like breathing oxygen, eating food and sleeping. I have emotions that are very complex and unique.

Powered by DjangoBB