Page 97 - IT_V5.0_Class8
P. 97

4.   Create a Scratch project where a bird sprite continuously flies up when the spacebar is
                       pressed and falls down when the Spacebar is not pressed. The game should end when
                       the bird sprite touches the ground.
                   Hint:

                       a. Create Sprites

                           i.  Add a        sprite.



                          ii.  Add the         sprite to make the ground.

                       b. Bird Movement

                           i.  Use           to start the game.


                          ii.  Use           block to constantly check for player input and gravity.



                         iii.  Inside the loop, use               block to check if the spacebar is being pressed.
                         iv.  If the spacebar is pressed, use            block to make the bird fly upward.

                          v.  Use            block to move the bird left to right.

                         vi.  If not pressed, use           block to make the bird fall downward due to gravity.


                       c. Game Over Condition

                          i.   Inside the same forever, use                       to check if the bird touches the
                            ground.

                         ii.  If the bird touches the ground, use          to end the game.






                                                                                              Learning Scratch   95
   92   93   94   95   96   97   98   99   100   101   102