X-Pong
Pong. Why is this game so well known, even after 51 years? Simple. Pong itself is fairly boring. Just seeing a little ball travel throughout the screen. But what makes pong still well known today, is the variations and changes the community has made with it. This project will show you not one, not two, but six of them, all in one project. This is X-Pong.
Disclaimer: If you attempt to make everything by following the instructions, it may look different than X-Pong. I have purposely kept the instructions non-specific so that the imagination could be left to you.
Supplies
You will need the following:
Scratch
Mouse (Optional but recommended)
Overview
Overview of my game.
Sprites
First, Sprites. This is the easiest step. For the player and computer, just put a simple rectangle. For the ball, just put a circle. Make sure to keep the sprites centered.
Basic Code
Now to make the code. This step is also simple. Just Follow the pictures. The first picture is for the player, the second picture is for the computer, and the third picture is for the ball. In order to get the "Y position of ball" block, go to sensing, then drag out the "Backdrop # of Stage" block, change the second drop-down to your ball sprite, then change the first dropdown to y position.
Scoring
Now that we have the basics, we need a scoring mechanism. This is also quite simple. First, create two rectangles with no outlines, and make them the same color as your background so they blend in. Make it skinny, but also tall enough to reach the top and bottom of the screen. Finally, make them both go to X:0 Y:0, and drag One of them to the left, and one of them to the right. Name the one on the left "Player Scorer" and the one on the right "Computer Scorer"
Now, create two variables: One called "player score" and one called "Computer Score". Make them both for all sprites.
Go to the ball and add the following code so that it looks like the picture.
Custom Counter(Optional)
This step is optional.
The variable counters look a bit ugly, so let's change that. Fuelvin made a very good tutorial on how to do this. Go to 9 minutes and 34 seconds. for the custom counters.
Mystery Box
Now for the fun part, the mystery box. This is also the most complicated step. In X-Pong, there are six powerups, but for now, I will only show one. This power-up will make the paddles larger.
First, Create a simple box.
Then, create a new variable called "Effects". Make sure to check the "For all sprites" option. The reason we just want to pick randomly from a certain area and not just a random position block is because in that space, the only thing that is there is the ball. If we put a random position block, it could end up in the paddle, or even behind the paddle where it's impossible to reach.
Now, go to the player sprite, and costumes, then duplicate the existing costume. Stretch it out on both ends and center it. Copy this costume and put it in your computer sprite. Also, change the costume names to make it easier to remember. Name the normal one "Normal" and the long one "Long". Next, go to your player and computer sprite and put the code shown in the second picture into the forever loop.
Finishing Touches
That's the base of the game. You can add more power-ups, change how things look, add sounds, etc. It's your game now. Do what you want with it.