top of page
B Madjaros

How to Create Pong on Game Maker

Updated: Jun 15, 2023

The good citizens of KTS Towers enjoy creating games using Gamemaker. B Madjaros guides us through creating a 2 player version of Pong - the world’s first game


Dont like reading?, Try our video tutorial.


A Bit about Game maker

You might have noticed Gamemaker whether when you were looking at files, or when you used it in a computing lesson. Gamemaker, although not seeming like it, has the potential to create good 2D games. Here are a few famous games you might have heard of that were made in Gamemaker: Undertale, Deltarune, and Shovel Knight. At a first glance, Gamemaker might seem a bit complicated. With this quick tutorial below, you will get started in no time creating your own games or minigames.


Getting Started

So, first open up Gamemaker using the Windows Search Bar (remember, Game Maker is not on Mac). It is on your school computer. Then, click continue using the lite version as the paid version costs money and really does not add much. It will show you a bunch of buttons and a tutorial on the right. You can close the tutorial if you want to as I am going to show you how to create a different game - a two player Pong.


Sprites and How to Use Them

You might notice that there is a red Pacman with a hole for an eye on the top bar under the main menu bar. You should click it and it will pop up with a form. Name it “Ball”. Now you can click edit and you will be greeted with a blank screen and a lot of buttons. One button at the top will be a blank sheet with a plus next to it. Click it and then a square will appear. Double click on that and you will see you are inside it. If you want it to be larger you can hold the Control button on your keyboard and scroll the mouse wheel or press the plus or minus button.

Now that you have your ball sprite, select two colours on the pallet on the right. Left click on a colour for the outside of the ball and right click on a colour for the inside of the ball. Then you can select the button with a circle on it and hold it and move it on the main square to create a circle.

Congratulations, you have now made your first sprite! Just to be clear, a sprite in Gamemaker is just images that you can animate that will be the appearance of an object. The object is the actual thing that interacts with your game or does things.

PULL Quote “Congratulations, you have now made your first sprite!”

Making the rest of the sprites

Next, click the Pacman again for another sprite but name this one “Wall”. Then, after you make your image and go inside it, click transform at the top and select resize canvas. Put the size to 200% and click OK. Then, do the same thing using the circle tool but instead use the rectangle tool. Make sure it is not a square as the canvas. Finally, the final sprite we are making, just use the bucket tool on a new one to make a white square called “Invisible wall”. Now you are done with all the sprites you need for the game!

Making your first objects

After that, click on the image of a blue sphere to create an object. We will be making the invisible wall. All you need to do is create a new object, then name it “Invisible Wall” (make sure you select the sprite with the corresponding name) and untick the visible button and tick the solid button. Next, use the sphere again to make another object. Call this one “Wall”. Put the sprite to be the wall. Then, add an event and instead of clicking Create, click Key Press and click Up. Then, go back to the eight red arrows but only select the one pointing up. Set the speed to four. Then, add an event for pressing the down arrow, set the speed for four and press the down arrow. Next, make it bounce off the invisible wall. You’re well on the way to being a game maker!

Finally, use the release key and select up. Select the 8-arrow box again but click the middle box and keep the speed zero. Duplicate this event and change it to the down arrow. Make sure this is solid as well. And then make “Ball”. Click on where it says no sprite and select the ball sprite. Then, go over to Add Event and click it and then choose create which should be on the top left of the list. Look to the right of the form and you will see a box with eight red arrows on it. Drop into the action box. Then set speed to five and select all four of the diagonal arrows. Then, tick the solid box. Then, go to the sphere again.

Final Additions on Coding the objects

Next, duplicate the Wall and name it “Wall 2”. Right click on the events and for the top event, the one if you press up, right click and press change event. Change it to W in key press and letters. Then, change the other one using the change event to keypress S key. Remember to add the key release for W and S so when you let go of them the platform stops moving. Just use a change event.

Finally, the final object Now go back to the ball and adds a Collision event with the Wall. You will see that underneath jump at the bottom of the middle column is a square with an arrow bouncing off a blue wall. Drag and drop it and click ok. Then make a new collision event with Wall 2 and Invisible wall where it will bounce off. Now you are done with the proper coding and just need to place the objects!

Making the Room

There will be at the top of your screen again, next to the object button will be a white rectangle with blue on the top. Click on it and go to settings. Name it “Pong” in Name and Caption for the room. If you want the background to be a different colour, then you need to go to backgrounds and choose a colour. Then, go to objects and place the object Invisible Wall on the outside of the room or out of bounds. Make sure you untick the Delete Underlying box at the bottom as this will make it easier. To spread it easier you can just left click in a corner and drag while holding left click and shift.

If you want to remove an instance (which is the fancy name for one version of an object in the room) you can right click it. Then, just to the left of the edge of the room, not on a white square, place Wall. Then, on the opposite side of the room, place Wall 2. Place the ball roughly in the middle. Now, save the room by clicking the tick. If you were doing the Invisible Wall out of bounds it will ask you whether you want to delete all objects outside the boundary. Click no.


You're done!

Now press F5 to quickly play it and you have got a basic two player pong! Well Done! (If you want it on full screen, press F4). It should show a ball bouncing around and there will be two platforms on each side of the screen. You can press w and s for one to go up and down and the up and down arrow for the other one to go up and down. The ball should bounce off of the platforms and be slightly faster than them.

If you want to play against someone, choose to be the walls and keep track! Now you can impress your family with what you have made!


Extras

Want to make it look better? This section will teach you how to make visible walls to make the layout a bit more interesting and a custom background! To make a background you need to go back to the top of the screen. Near the button to create an object there will be an image of a landscape. Click on it and it will come up with a screen very similar to the image sprite. When you click to edit the background though you will not need to create an image as backgrounds can’t be animated. You can do whatever you want on this page. After you are done, you can save it like the sprites. To apply this you need to open the room by double clicking on it and there will be 3 tabs. You need to click on backgrounds and then go down halfway. There will be a box with it saying no background and a page being clicked next to it. Click the box and choose your background. Alternatively you can make it one solid colour without a background. You go to the background and select the colour in the box at the top and choose whatever colour you want. The other thing you can add is some walls around the area to make it a bit more unpredictable. You just need to right click the invisible wall, duplicate it and name it something else. Then, you go to the ball and right click on a collision event and press duplicate. Then go to collision and select the new object. You can then go into the room and spread some out although not too many or else the ball will barely ever reach the edges of the screen.

If you are unhappy with the fact you can only score once before having to restart the game and the fact that there is no score you can follow this link to a video that will make your Pong game even better:


Coding at home

If you want to do this at home, you can install Gamemaker using the files in this google drive:



Credits : YoYo Games

18 views

Recent Posts

See All

Comments


bottom of page