You are on page 1of 46

PONG GAME

DONE BY GAME MAKER


Game maker icon
To open a new To open a ready
project project
For designing and programming a new
game
An empty game
Locate the game Name the game
The workspace
Parts used to build the game
Objects to
program and
built the game

The space of the


game

Shapes used in
the game
: To make the game’s shapes
Click with the mouse right button on sprites then click
on Create
: To make the game’s shapes
Then click on sprite from the list
In the pong game we have two shapes a ball and a bar for the
player that’s why we do this part for two times
The two sprites appears in the We’ll have two sprites for the
workspace two shapes we have in the
game
We change the name of ( sprite1 ) to ( sPlayer ) to show that it’s
the shape of the player
We change the name of ( sprite2 ) to ( sBall ) to show that it’s the
shape of the ball
This window appears to We click here to change the
alter the length and width length and width of each of
of the shape than we click the shapes so it can has a
Apply proper shape
We click on Edit Image too alter the color and the other
properties of the shape
Click on the f button to alter the color and choose a color then click
on the shape which we point to by the arrow
The colored is changed and then we shut the window
We choose from this list ( middle center )
We make two objects to control and program the game , they’re
done the same way as sprites
We change the names of the objects the same way to make it easier
to understand and from ( No Sprite ) the proper shape for each
object
We choose the proper shape for each object from the window that
appeared by clicking on ( No Sprite )
We click on Rooms which is the game space which the game
appears on to choose the shape’s places
Here is where ( Rooms ) size is Here how ( Rooms )
altered appear
It’s called Resolution
We click on the object to drag and put it in the right place
So we put the ball in the middle and two player bars to both sides
so the ball can go between them
Here we declare the variables
We have oPlayer variable with default value 0
We declare the player variable with default value 0 , we
have two players so one of them will be ( playero )
And the another is ( player1 )
By going back to ( Rooms ) to assign which player is 0 and which one
is 1
We click on one of them twice to show the list to choose a variable
The first player will be a variable and it’s value is going to be 0
The second player will be a variable and it’s value is going to be 1
We get back to oPlayer to add an event which is used to program the
game and make the movement
First we click on Create
Create appears to code it
We define a variable and name it ( spd ) for
speed valued 10
We add ( step event ) to code the game steps
This means ( player1 ) moves up if we click up button and moves
down if we clicked down button , ( keyboard_check ) is a function to
check the used button
y is a variable to determine speed , This means ( player2 ) moves if we
here if the ball moves down with click ( S ) button and ( w ) button ,
-speed 10 , or up with speed 10 so we use these buttons to play
A code to prevent the player bars out of the game screen
Add a Create event for the ( oBall ) to program its movement
The horizontal movement of the ball in the game
We add ( step event ) too to control the steps of the ball movement
To prevent the ball movement out of the game screen and to move
vertical too
-If it moves down 5 then it will move up 5
To program the collision operation of the ball with the players bars to
the sides of the game we add a ( collision event ) to the ( oBall ) with
the ( oPlayer )
The ball moves The horizontal speed will If the ball was on left of the
between two
increase by 1.05 every time screen , it will move to the
horizontal specified
numbers the ball hits one of the right and the other way
players around
Add ( other event ) to the ( oBall ) we choose ( outside room )
A function to get the game started again if the player lost and the ball
was out
Running the game

You might also like