Pong

Pong is a classic 2D arcade game based on Ping Pong. It is classified as being in the 'ball and paddle' video game genre.

Pong Sprites

This pong spritesheet has a tilesize of 16x16. The background color is flat black #000000.

pong.png

Pseudocode

Set up window
Load resources (images and sound)
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
        play collision sound

    if ball collide with borders
        change ball vertical direction
        play collision sound

    if ball out of screen
        reset ball
        add point to player who touched ball last
end loop

Related Pages

Design Document

Similar Games

Categories: Arcade Games
page_revision: 14, last_edited: 1238002920|%e %b %Y, %H:%M %Z (%O ago)