Discuss Scratch

Kwan1234
Scratcher
2 posts

Can anyone please tell me why this is not working?

I made this cootie catcher and it isn't working. I would greatly appreciate it if anyone could tell me how to get it working. I'm sorry it has more code than it needs. Any tips on that too would also be helpful.
https://scratch.mit.edu/projects/178256471/
Try combination red or green with even number, or blue and yellow with odd number, as they are the ones not working.
MonzaM0nk3y123
Scratcher
14 posts

Can anyone please tell me why this is not working?

i didn't read it all, but I think that you could try broadcasting once the answers is well your problem basically
deck26
Scratcher
1000+ posts

Can anyone please tell me why this is not working?

Don't use so many broadcasts and it will be less confusing. If the only difference between red and green is how the number sprites respond you'd be better using two costumes and one sprite and just setting a number of times that you want the costumes to change before making a broadcast ‘shownumbers’ which you use for each colour.

Your main problem is that ‘answer’ will store it's previous value until it is changed so condensing your scripts to the following for clarity

repeat until <<(answer) = [1]> or <(answer) = [2]>
custom block returning 1 or 2 in answer
end
repeat until <<(answer) = [1]> or <(answer) = [2]>
custom block returning 1 or 2 in answer
end
The second repeat until will never do anything.

Since you can't manually reset ‘answer’ one option would be to use your own variable which you can reset to 0 before prompting for a new value. I'd move the repeat until and the variable reset into the Numset custom blocks which will help make the flow of your code easier to understand.

Powered by DjangoBB

Standard | Mobile