Page 41 - Ones and Zeros 4 (Student Book)
P. 41

Scripts

                                                                                                            Lesson
                                                                                                            Lesson





                                                                                                                  3
                                                                From the ‘Events’ menu, click and drag
                                                                the ‘event’ block, ‘when this sprite
                                                                clicked’.
                                                                By adding this event, the programme will
                                                                start when we click the sprite.








                4
                    Now we’ll make the sprite (the wizard)
                    ask your name. Add the ‘sensing’ block
                    ‘ask ‘what’s your name’ and wait’. The
                    ‘sensing’ block must be added under
                    the ‘event’ block.







              Fun Time!


              Running your script.
                1    Let’s run the script by clicking on the
                     green flag called ‘Go’.

                2   The programme is now running. Click on
                     the magician sprite. As you can see, he
                     is asking for your name. In the field
                     below, type your name and press the
                     ‘Enter’ key.
                3   Save the project.






              Challenge Yourself!

              There are more ‘event’ blocks you can use to start the script. Try the one named, ‘when
              ‘space’ key pressed’. This block also lets you change the key you can use to start the
              script. Try using this block and choose different keys.



                                                                                                                39
   36   37   38   39   40   41   42   43   44   45   46