Build the game Pong Build the classic game Pong and learn how to animate image sprites, deal with collisions, keep score, and define procedures to make your code better. First Step: Add the following components Canvas – Canvas1 Ball – Ball1 ImageSprite – import a paddle image Button – ButtonStart Button – ResetButton Label – Score Label – Score_number Checkbox – Sound on Next Coding the Game Step 1: Code it so a ball moves downward (animated) Add blocks so that clicking on the start button enables the ball and sets its speed/heading to move downward. Get a random number for a range of numbers and set the heading to the randomly generated number. Step 2: Code it so the ball bounces off edges and the paddle Program the ball.EdgeReached event and use the Bounce operation. For the paddle, program CollidedWith and change the Heading. 1 Step 3: Code it so the user can drag the paddle horizontally Program the Paddle.Dragged event and modify only the X property of the paddle Step 4: Code it so you get a point every time the paddle hits the ball Modify the ball.CollidedWith to modify the score. Use a procedure which adds one to the score and updates the label showing the score. Be sure and set the Score to 0 at proper times. Step 5: Code it so game over when ball hits bottom edge. Check the particular edge that is hit on EdgeReached and game over if bottom. 2 Step 6: Code it so there is sound effects for paddle, edges, and game over Add some sound files in the designer then play them in the various events. Step 7: Code is the user can check a box to turn sound off (or no) (click for details) Add a checkbox. Anytime you are playing a sound, check to see if checked-- us a procedure to simpify. 3 Programming Challenge 1. Add two buttons. One named EASY and the other named DIFFICULT. Write a program that when the: a. Easy is clicked the ball moves slowly. b. When the Difficult is clicked the ball moves faster. c. When the Difficult is clicked it makes the ball smaller 2. Add an intro screen with the easy and difficult buttons. When the button is pressed it displays the easy level or difficult level. 3. Can you program the game to have levels? a. Display a level label and write a procedure that will change the levels variable by 1 and change the label. b. You will need a “if statement” in your program so that when the score reaches 5, it will change to level 2 and the ball will get smaller and/or faster. “Else if” when score equals 10 it will move to level 3, else if score equals 15 it will say “YOU WIN”. 4
© Copyright 2026 Paperzz