Page 73 - TechPluse_C4_Flipbook
P. 73

7                             Game on Scratch















                              Your Aim

                               to learn about:

                                     Creating a Simple Game            Using Operators
                                      Variables                          Conditions
                                       Sensing Blocks                      Storing User Input
                                         Loops                               Graphic Effects






                 In the previous classes, you have learnt to use the code blocks to make the sprite perform a
                 variety of actions. You have also learnt to create various shapes and designs. In this chapter
                 you will learn to use other advanced blocks to create games and perform arithmatic operations.
                 Sprite is an interactive and versatile programming language that can be used to create complex
                 programs and algorithms. Scratch is one of the programming languages used in robotics. You

                 can store values in the form of variables and use them to create various programs. Let us begin
                 with creating a simple game.

                     CREATING A SIMPLE GAME

                 Let us create a simple game in Scratch with the blocks learnt
                 so far.

                 The game is about creating a basketball court with various
                 items like a basketball, two players, etc. and showing the
                 boys playing basketball.
                 The image shows how the program opens, it displays 2 boys,
                 a basketball court and a ball. It is a simple program. When

                 the green flag is clicked, the boys move to their position
                 and the ball starts moving from one boy to the other. The
                 code also specifies the initial position of each sprite when
                 the green flag is clicked.



                                                                                                  Sprites


                                                                                               Game on Scratch       71
   68   69   70   71   72   73   74   75   76   77   78