Page 45 - ODV Training outline_EN
P. 45







               emit  sounds.  There  are  countless  examples  of  how  to  do  this  on  the
               website itself, along with useful step-by-step guides, such as this one:
               https://resources.scratch.mit.edu/www/guides/en/Getting-Started-Guide-

               Scratch2.pdf

               Using  "Events"  and  "Control"  Blocks  to  Structure  Code  with  Loops  and
               Conditions

               After experimenting with simple storytelling programs, the next step is to start

               using blocks found in the "Events" and "Control" sections. Here, we'll find blocks
               that allow us to create temporal structures with waits and repetitions, as well as
               those that enable us to manage conditions—meaning executing pieces of code
               only "if" certain conditions occur.
               These blocks are crucial for creating structured code, and their functionality
               is  fundamental  for  understanding  and  abstracting  concepts  related  to

               computational thinking.
               As an example, let's imagine wanting our character (sprite) to interact with us by
               playing hide-and-seek—when we hover the mouse pointer over it, it disappears
               only to reappear shortly after in a different random position. How can we impart

               such logic? We need to think algorithmically and abstract the basic concepts: we
               need to indefinitely repeat an instruction that hides the character only when the
               condition of being touched by the mouse pointer is met. Then, we make it move
               to a random position and ensure that when the previous condition is not met, it
               stays  still  and  visible.  Below  is  a  block  code  that  achieves  the  mentioned

               behaviour.
























                                    With this code, the cat keeps hiding for one
                                       second when we hover over it with the
                                     mouse and reappears at a different point
                                                     on the stage.

                                         Funded  by  the  European  Union.  Views  and  opinions  expressed  are  however  those  of  the
                                         author(s) only and do not necessarily reflect those of the European Union or the European
                                         Education and Culture Executive Agency (EACEA). Neither the European Union nor EACEA can
                                         be held responsible for them. Proposal number: 101087107.

   40   41   42   43   44   45   46   47   48   49   50