Page 70 - 2501_KVS_C-5
P. 70

Step 3:   Drag and drop the “mod” block, inside the “if-then” block. (shown in Fig.
                              6.9)




















                                                                 Fig. 6.9
                     Aryan: Please explain these operators in our “spaceship” game.

                     Gowri:  Dear Aryan, in our game of “spaceship”, three times “pic random. to …” block is used, for
                            following reasons:

                     1)      “wait pick random 0.2 to 1” block means, to generate a clone of sprite “planet” at a random
                            interval of time between 0.2 to 1.

                     2)      In “go to x 220 y pick random -170 to 170” block means that every time, this sprite clone
                            will appear in the stage at 220 position horizontally means from right side, but vertically
                            can be any position from -170 to 170 position.
                     3)      “move pick random 5 to 10 Steps” block means moving the sprite “planet” towards the
                            sprite “spaceship” random number of steps from 5 to 10. It means the speed of moving
                            the sprite will be different for every clone.



                     Aryan: How to finish the game when the life of the sprite “spaceship”
                     finished? This coding is not shown in Fig.  6.8. Please explain this also.

                     Gowri: Yes, sure, Dear! Now we will learn how to stop the game when
                     the “life” of the sprite has finished and the value of variable “life” will
                     become zero. Do this coding inside the “forever” block. (see Fig.  6.10)
                                                                                                        Fig. 6.10
                  Let’s now learn to finish the game. Add a new sprite “star” and change its costume
                  using “Costumes” tab, (see Fig. 6.11) and also change its name as “Gameover” and
                  then do the coding on this sprite. (see Fig.  6.12) This sprite will be visible, only when

                  the game is over.











                68                         KVS DELHI REGION 2025
   65   66   67   68   69   70   71   72   73   74   75