This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2013-03-05 22:59:46

tillantas
New Scratcher
Registered: 2013-03-05
Posts: 1

stage 4 - Super Scratch Programming Adventure

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
  show
and 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 wait
So the question are: a) can anyone here replicate the problem, and b) explain why it's not behaving as expected?

We're using Scratch 1.4 on Windows 7. Thanks in advance for your time.

signed,

perplexed.

Offline

 

#2 2013-03-06 06:52:27

Smozzick
Scratcher
Registered: 2011-10-23
Posts: 100+

Re: stage 4 - Super Scratch Programming Adventure

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)


http://i50.tinypic.com/ded8m.png

Offline

 

Board footer