In One Sentence


Game Flow


Game Screens

Game Screen 1

Game Screen 2



Old Page

The old Pong Page is archived here.

Pong is a very simple game. It is based on the game ping-pong.


initialize game tool

create all variables

load all sprites
load all images

The Player

Moving the Player

The player moves only up and down, so you would move the player like you would any other game object, just on it's y axis.

if key arrow_up is pressed move player up
if key arrow_down is pressed move player down

Temporary Storage

Set up window and load images
Initialize needed variables such as position of ball and players

// Main loop
While not escape pressed
    // Read keyboard
    if keyup pressed
        move yPlayer up
    if keydown pressed
        move yPlayer down

    // Move ball according to hspeed and vspeed

    // Move computer opponent
    if ball above opponent
        move opponent up
    if ball below opponent
        move opponent down

    // Draw graphics
    draw playfield
    draw ball
    draw player
    draw opponent

    if ball collide with player or opponent
        change ball horizontal direction

    if ball collide with borders
        change ball vertical direction

    if ball out of screen
        reset ball
        add point to player who touched ball last
end loop
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution 2.5 License.