Page 114 - 2611_SmartGPT Pro V(5.0) C-5
P. 114

▶   Create a game of Pong using the knowledge of all the various blocks you have learnt so far. The
                    goal of the game is to keep the ball moving by hitting it with the paddle and preventing it from
                    touching the red line. Add a background and other customisations according to your creativity.

                       Follow the instructions below to create the game. (You can also make changes accordingly).
                       (a)  Create two sprites: a ball that the user will be playing with and a paddle to control the ball.









                       (b)  Now, let’s create stacks of blocks to move the paddle sprite left and right so that it can
                        come in contact with the ball.










                       (c)  To control the behaviour and movement of the ball, create the following stacks of code for
                        the ball.






















                       (d)  Add a red line to the background. The game will be over for the user when the ball touches
                        the line.














                       The completed project should look like this. Now you can add customisations like changing the
                    costumes of the sprites, adding backgrounds, adding sound effects, increasing the speed of the
                    ball to make the game more difficult, etc.




                   112  Computer Science (V5.0)-V
   109   110   111   112   113   114   115   116   117   118   119