Hello, (the dad talking here):
In Stage 4 of Super Scratch Programming Adventure (http://nostarch.com/scratch) the game can be won, but losing is never possible (we should always be so lucky!). The game is shared here: http://scratch.mit.edu/projects/tillantas/3153648
As you should see, the condition for losing if the "chance" variable becomes less than 1. During play each time the "virus" sprite makes contact with "server" sprite chance is reduced by 1. We can see this does happen, as chance is reported to the display and it does indeed become less than 1. However for some reason we can't figure out the "broadcast [lose]" event is either never fired or not received.
The almost duplicate block for winning a game, if "score" is great than 29, works just fine.
in sprite "lose":
when I receive (lose) go to x(0) y(0) go to front showand the trigger in sprite "virus":
when I receive (start) set chance to (5) wait (0.5) secs forever if touching (server)? change chance by -1 broadcast (oh) wait (0.5) secs if (chance) [<] (1) hide broadcast (lose) and waitSo the question are: a) can anyone here replicate the problem, and b) explain why it's not behaving as expected?
Offline
a) Yes, exact same problem when I tried it.
b) YES! Change the chance block for a new one. You've got a list block in there, not a variable one.
How it happened: (Notice that its a darker orange than other variable blocks; it seems like someone might've created a list called chance, used that and then deleted it and made a variable.)
Took a while to notice o.O
Last edited by Smozzick (2013-03-06 06:58:59)
Offline