I've been going through major hell trying to get just one. damn. simple. little. game. working. I can't even complete ping pong! There's almost no game easier than ping pong, and I can't even do it after so much stress trying, and I'm becoming so frustrated over this that I want to kill everyone.

I don't have any clue on how to post code tags here.

This is my best code so far, and not enough enough to do anything decent, and I'm dead tired after spending hours writing this:

....#include <SDL/SDL.h>
void PlayerControl(SLD_Surface* TEMPIMAGEHM, SDL_Surface* BGTEMP1, short PTheight, short PTwidth, short PTxspeed, short PTyspeed, short PTxoff, short PTyoff);
void ComputerControl(SDL_Surface* TEMPIMAGECO, SDL_Surface* BGTEMP2, short CTheight, short CTwidth, short CTxspeed, short CTyspeed, short CTxoff, short CTyoff);
void GameBall(SDL_Surface* TEMPIMAGEBALL, SDL_Surface* BGTEMPBALL, short BTheight, short BTwidth, short BTxspeed, short BTyspeed, short BTxoff, short BTyoff);
void ScoreBar(SDL_Surface* SCORETEMP, SDL_Surface* BGTEMP3, short STheight, short STwidth, short STxspeed, short STyspeed, short STxoff, short STyoff);
void ReadyText(SDL_Surface* READYTEXT, SDL_Surface* BGTEMP4, short RTheight, short RTwidth, short RTxspeed, short RTyspeed, short RTxoff, short RTyoff);
void GoText(SDL_Surface* GOTEXT, SDL_Surface* BGTEMP4, short GTheight, short GTwidth, short GTxspeed, short GTyspeed, short GTxoff, short GYyoff);
void BALLFINDER(SDL_Surface TEMPBALLXPRINT, SDL_Surface *TEMPBALLYPRINT, short, short);
struct GameBall
{
short Bheight;
short Bwidth;
short Bxspeed;
short Byspeed;
short Bxoff;
short Byoff;
bool InBounds;
}; GameBall BALL;
struct ScoreBar
{
short Sheight;
short Swidth;
short Sxspeed;
short Syspeed;
short Sxoff;
short Syoff;
bool Sapply;
}; ScoreBar SCORE;
struct ReadySplash
{
short Rheight;
short Rwidth;
short Rxspeed;
short Ryspeed;
short Rxoff;
short Ryoff;
bool Rapply;
}; ReadySplash READYTEXT;
struct GoSplash
{
short Gheight;
short Gwidth;
short Gxspeed;
short Gyspeed;
short Gxoff;
short Gyoff;
short Gapply;
}; GoSplash GOTEXT;
struct playerpaddle
{
short Pheight;
short Pwidth;
short Pxspeed;
short Pyspeed;
short Pxoff;
short Pyoff;
short PPoints;
bool PCanMove;
}; playerpaddle Player;
struct computerpaddle
{
short Cheight;
short Cwidth;
short Cxspeed;
short Cyspeed;
short Cxoff;
short Cyoff;
short CPoints;
bool CCanMove;
}; computerpaddle Computer;
struct computerlogistics
{
double CReactSpeed;
double CReactFromFirst;
double CReactFromLast;
double CFocusPercentage;
short firstmeasure;
short lastmeasure;
int randomizer;
}; computerlogistics CPU;
int main(int args, char
LOCATION[])
{
bool GAMELOOP = 1;
playerpaddle Player;
computerpaddle Computer;
GameBall BALL;
Scorebar SCORE;
ReadySplash READYTEXT;
GoSplash GOTEXT;
Player.Pheight = 30;
Player.Pwidth = 64;
Player.Pxspeed = 0;
Player.Pyspeed = 0;
Player.Pxoff = 136;
Player.Pyoff = 385;
Player.PCanMove = true;
Computer.Cheight = 30;
Computer.Cwidth = 64;
Computer.Pxspeed = 0;
Computer.Pyspeed = 0;
Computer.Cxoff = 136;
Computer.Cyoff = 15;
Ball.Bheight = 26;
Ball.Bwidth = 26;
Ball.Bxspeed = 0;
Ball.Byspeed = 0;
Ball.Bxoff = 174;
Ball.Byoff = 199;
READYTEXT.Rheight = 60;
READYTEXT.Rwidth = 124;
READYTEXT.Rxspeed = 0;
READYTEXT.Ryspeed = 0;
READYTEXT.Rxoff = 140;
READYTEXT.Ryoff = 101;
GOTEXT.Gheight = 60;
GOTEXT.Gwidth = 124;
GOTEXT.Gxspeed = 0;
GOTEXT.Gyspeed = 0;
GOTEXT.Gxoff = 140;
GOTEXT.Gyoff = 101;
SDL_Init(SDL_INIT_EVERYTHING);
SDL_Surface* PLAYERPADDLE = SDL_LoadBMP("playerpaddle.bmp");
SDL_Surface* COMPUTERPADDLE = SDL_LoadBMP("computerpaddle.bmp");
SDL_Surface* BALL = SDL_LoadBMP("ball.bmp");
SDL_Surface* SCOREBAR = SDL_LoadBMP("score.bmp");
SDL_Surface* READYMSG = SDL_LoadBMP("readysplash.bmp");
SDL_Surface* GOMSG = SDL_LoadBMP("gosplash.bmp");
SDL_Surface* SCREEN = SDL_SetVideoMode(32, 400, 450, SDL_SWSURFACE, SDL_HWSURFACE, SDL_DOUBLEBUF);
SDL_SetColorKey( PLAYERPADDLE, SDL_SRCCOLORKEY, SDL_MapRGB(surface->format, 255, 0, 255) );
SDL_SetColorKey( COMPUTERPADDLE, SDL_SRCCOLORKEY, SDL_MapRGB(surface->format, 255, 0, 255) );
SDL_SetColorKey( BALL, SDL_SRCCOLORKEY, SDL_MapRGB(surface->format, 255, 0, 255) );
SDL_Event EVENT;
if(GAMELOOP == 1)
{
if(SDL_PollEvent(&EVENT))
{
if(Player.PCanMove == true)
if(EVENT.type == SDL_KEYDOWN)
{
switch(EVENT.key.keysym.sym)
{
case SDLK_RIGHT: Player.xpos += 1; break;
case SDLK_LEFT: Player.Xpos -= 1; break;
}
else if(EVENT.type == SDL_QUIT)
{
GAMELOOP = 0;
}
}
SDL_FillRect(SCREEN, NULL, SDL_MapRGB(SCREEN->format, 220, 50, 192));
PlayerControl(PLAYERPADDLE, SCREEN, Player.Pheight, Player.Pwidth, Player.Pxspeed, Player.Pyspeed, Player.Pxoff, Player.Pyoff);
ComputerControl(COMPUTERPADDLE, SCREEN, Computer.Cheight, Computer.Cwidth, Computer.Cxspeed, Computer.Cyspeed, Computer.Cxoff, Computer.Cyoff);
SDL_Flip(SCREEN);
}
}
}
void PlayerControl(SLD_Surface* TEMPIMAGEHM, short PTheight, short PTwidth, short PTxspeed, short PTyspeed, short PTxoff, short PTyoff);
{
SDL_Rect SRC;
SDL_RECT DST;
SRC.x = PTxspeed;
SRC.y = PTyspeed;
SRC.h = PTheight;
SRC.w = PTwidth;
DST.x = PTxoff;
DST.y = PTyoff;
DST.w = PTwidth;
DST.h = PTheight;
SDL_BlitSurface(PLAYERPADDLE, &SRC, SCREEN, &DST);
}
void ComputerControl(SDL_Surface* TEMPIMAGECO, SDL_Surface* BGTEMP2, short CTheight, short CTwidth, short CTxspeed, short CTyspeed, short CTxoff, short CTyoff);
{
short SCRNCENTXL1 = 200;
short SCRNCENTXL2 = 220;
short SCRNCENTXL3 = 240;
short SCRNCENTXL4 = 260;
short SCRNCENTXL5 = 280;
short SCRNCENTXL6 = 300;
short SCRNCENTXL7 = 320;
short SCRNCENTXL8 = 340;
short SCRNCENTXL9 = 360;
short SCRNCENTXL10 = 380;
short SCRNCENTXL11 = 180;
short SCRNCENTXL12 = 160;
short SCRNCENTXL13 = 140;
short SCRNCENTXL14 = 120;
short SCRNCENTXL15 = 100;
short SCRNCENTXL16 = 80;
short SCRNCENTXL17 = 60;
short SCRNCENTXL18 = 40;
short SCRNCENTXL19 = 20;
short BALLCURX = GameBall.Bxspeed;
short BALLCURY = GameBall.BYspeed;
short *BALLFINDERX = &BALLCURX;
short *BALLFINDERY = &BALLCURY;
computerlogistics CPU;
CPU.firstmeasure ++;
CPU.lastmeasure;
srand((unsigned)time(0));
CPU.randomizer = rand();
rand() % 2;
switch(randomizer)
{
case default: CPU.CFocusPercentage = 0.8; CPU.lastmeasure ++; break;
case 1: CPU.CFocusPercentage = 1.2; CPU.lastmeasure ++; break;
case 2: CPU.CFocusPercentage = 1; CPU.lastmeasure ++; break;
}
switch(randomizer)
{
case default: CPU.CReactSpeed = 0.2; break;
case 1: CPU.CReactSpeed = 0.3; break;
case 2: CPU.CReactSpeed = 0.4; break;
}
CPU.CReactSpeed + CPU.CFocusPercentage = CPU.CReactFromFirst;
rand() % 1;
switch(randomizer)
{
case default: CPU.CReactFromLast = 1.2; break;
case 1: CPU.CReactFromLast = 1.6; break;
}
CPU.CReactFromLast = CPU.lastmeasure * BALLFINDER;
void BALLFINDER(BALLCURX, BALLCURY, BALLFINDERX, BALLFINDERY);
if(BALLCURX < 225)
{

}....

Here is python code ping pong game:

import pygame, sys, random, os
from pygame.locals import *
import screen
import screem
os.environ['SDL_VIDEO_CENTERED'] = '1'

# Pygame init
pygame.init()
screen = pygame.display.set_mode((640,360),0,32)
clock = pygame.time.Clock()
pygame.key.set_repeat(20,1)
pygame.display.set_caption('DuBstep PoNg')

# Farben
BLACK = (0,0,0)
WHITE = (255,255,255)

# Schriftart
basicFont = pygame.font.SysFont(None, 48)
startFont = pygame.font.SysFont(None, 28)
playerFont = pygame.font.SysFont(None, 20)
punktFont = pygame.font.SysFont(None, 72)

#Win Loose Text
winText = basicFont.render('WIN', True, WHITE, BLACK)
looseText = basicFont.render('LOSE', True, WHITE, BLACK)
winTextRect = winText.get_rect()
looseTextRect = looseText.get_rect()

# Starttext
restartBoolean = True
startText = startFont.render('press SPACE to start a new game', True, WHITE, BLACK)
startTextRect = startText.get_rect()

centerx = screen.get_rect().centerx
y = 240

startTextRect.centerx = centerx
startTextRect.y = y
musicText = startFont.render('m to mute music', True, WHITE, BLACK)
musicTextRect = musicText.get_rect()
musicTextRect.centerx = centerx
musicTextRect.y = y + 30
soundText = startFont.render('s to mute sounds', True, WHITE, BLACK)
soundTextRect = soundText.get_rect()
soundTextRect.centerx = centerx
soundTextRect.y = y + 60
backText = startFont.render('1-3 to switch soundtrack', True, WHITE, BLACK)
backTextRect = backText.get_rect()
backTextRect.centerx = centerx
backTextRect.y = y + 90

#Background
bif = "skrillex.jpg" 
background = pygame.image.load(bif).convert()

# Flugrichtungen
speed = 0
startspeed = 100
speed_plus = 20
winkel = 0
# -1 up 1 down
ball_dir_updown = 1
# -1 left 1 down
ball_dir_leftright = 1

#Ball
ball_x = 302
ball_y = 162
ball_gr = (36,36)
ball_position_root = (ball_x,ball_y)
ball_position = (ball_x,ball_y)
ballif = "ballone.png"
ball = pygame.image.load(ballif).convert_alpha()

#Balken
playerspeed = 250
#temporaere startpositionen
a_x = 30
a_y = 162
b_x = 595
b_y = 30
balken_gr = (16,95)
balkenif = "balken.png"
balken = pygame.image.load(balkenif).convert()

# Punkte
player_a = 0
player_a_pkt_pos = (60, 55)
player_b = 0
player_b_pkt_pos = (540, 55)

#Spielernamen
playeraText = playerFont.render('Skrillex', True, WHITE, BLACK)
playeraTextRect = playeraText.get_rect()
playeraTextRect.x = 50
playeraTextRect.y = 35

playerbText = playerFont.render('Aoki', True, WHITE, BLACK)
playerbTextRect = playerbText.get_rect()
playerbTextRect.x = 530
playerbTextRect.y = 35

#Punkteanzeige
punkt0Text = punktFont.render('0', True, WHITE, BLACK)
punkt1Text = punktFont.render('1', True, WHITE, BLACK)
punkt2Text = punktFont.render('2', True, WHITE, BLACK)
punkt3Text = punktFont.render('3', True, WHITE, BLACK)
punkt4Text = punktFont.render('4', True, WHITE, BLACK)
punkt5Text = punktFont.render('5', True, WHITE, BLACK)

# set up music
soundBoolean = True

balkenSound = pygame.mixer.Sound('balken.wav')
punktSound = pygame.mixer.Sound('shotgun.wav')
wandSound = pygame.mixer.Sound('aa.wav')

def set_musik(music):
    if music == 1:
            pygame.mixer.music.load('skrillextwo.mp3')
    elif music == 2:
            pygame.mixer.music.load('skrillexone.mp3')
    else:
            pygame.mixer.music.load('aoki.mp3')

def draw_punkte(punkt, pos):
    punktText = punkt0Text
    if punkt == 1:
            punktText = punkt1Text
    elif punkt == 2:
            punktText = punkt2Text
    elif punkt == 3:
            punktText = punkt3Text
    elif punkt == 4:
            punktText = punkt4Text
    elif punkt == 5:
            punktText = punkt5Text
    screen.blit(punktText, pos)

def ball_hit_wall(ball_pos, ball_gr):
    global ball_dir_updown
    global ball_dir_leftright
    global ball_x
    global ball_y
    global player_a
    global player_b
    global speed
    global winkel

    # Ball trifft oberen Bereich
    if ball_pos[1] < 0:
            ball_dir_updown = 1
            winkel *= -1
            if soundBoolean:
                    wandSound.play()
    # Ball trifft unteren Bereich
    elif ball_pos[1] + ball_gr[1] > 360:
            ball_dir_updown = -1
            winkel *= -1
            if soundBoolean:
                    wandSound.play()

    # Punkt Spieler B
    if ball_pos[0] < 0:
            player_b += 1
            ball_dir_leftright = 1
            ball_x = 302
            ball_y = 162
            speed = startspeed
            winkel = 0
            if soundBoolean:
                    punktSound.play()
    # Punkt Spieler A
    elif ball_pos[0] + ball_gr[0] > 640:
            player_a += 1
            ball_dir_leftright = -1
            ball_x = 302
            ball_y = 162
            speed = startspeed
            winkel = 0
            if soundBoolean:
                    punktSound.play()

def move_player_a(ball_y):
    global a_y
    if a_y + 31 > ball_y and a_y > 0:
            #hoch
            a_y += seconds * playerspeed * -1
    elif a_y + 31 < ball_y and a_y + 95 < 360:
            #runter
            a_y += seconds * playerspeed * 1

def object_hit(a_pos, a_gr, b_pos, b_gr, seconds):
    global ball_dir_leftright
    global speed
    global winkel

    # errechne die 4 ecken von a
    aa = a_pos
    ab = tuple([a_pos[0] + a_gr[0], a_pos[1]])
    ac = tuple([a_pos[0] + a_gr[0], a_pos[1] + a_gr[1]])
    ad = tuple([a_pos[0], a_pos[1] + a_gr[1]])

    # errechne die 4 ecken von b
    ba = b_pos
    bb = tuple([b_pos[0] + b_gr[0], b_pos[1]])
    bc = tuple([b_pos[0] + b_gr[0], b_pos[1] + b_gr[1]])
    bd = tuple([b_pos[0], b_pos[1] + b_gr[1]])

    winkelmin = 1
    winkelmax = 10
    maxErreichterWinkel = 45

    #computerseite
    if aa[0] < 320:
            if punkt_innerhalb(aa, ba, bb, bc, bd) and punkt_innerhalb(ad, ba, bb, bc, bd):
                    ball_dir_leftright = 1
                    speed += speed_plus
                    if soundBoolean:
                            balkenSound.play()
            elif punkt_innerhalb(aa, ba, bb, bc, bd):
                    ball_dir_leftright = 1
                    speed += speed_plus
                    if winkel > maxErreichterWinkel * -1:
                            winkel += random.randint(winkelmax * -1, winkelmin * -1) * seconds * 5
                    if soundBoolean:
                            balkenSound.play()
            elif punkt_innerhalb(ad, ba, bb, bc, bd):
                    ball_dir_leftright = 1
                    speed += speed_plus
                    if winkel < maxErreichterWinkel:
                            winkel += random.randint(winkelmin, winkelmax) * seconds * 5
                    if soundBoolean:
                            balkenSound.play()
    #spielerseite
    else:
            if punkt_innerhalb(ab, ba, bb, bc, bd) and punkt_innerhalb(ac, ba, bb, bc, bd):
                    ball_dir_leftright = -1
                    speed += speed_plus
                    if soundBoolean:
                            balkenSound.play()
            elif punkt_innerhalb(ab, ba, bb, bc, bd):
                    ball_dir_leftright = -1
                    speed += speed_plus
                    if winkel > maxErreichterWinkel * -1:
                            winkel += random.randint(winkelmax * -1, winkelmin * -1) * seconds * 5
                    if soundBoolean:
                            balkenSound.play()
            elif punkt_innerhalb(ac, ba, bb, bc, bd):
                    ball_dir_leftright = -1
                    speed += speed_plus
                    if winkel < maxErreichterWinkel:
                            winkel += random.randint(winkelmin, winkelmax) * seconds * 5
                    if soundBoolean:
                            balkenSound.play()


def punkt_innerhalb(aa, ba, bb, bc, bd):
    if ba[0] < aa[0] < bb[0] and ba[1] < aa[1] < bd[1]:
            return True
    else:
            return False

def change_angle():
    pass

def change_direction():
    pass

#start musik
music = random.randint(1,3)
set_musik(music)
pygame.mixer.music.play(-1, 0.0)
musicPlaying = True


while True:

    for event in pygame.event.get():
            if event.type == QUIT:
                    pygame.quit()
                    sys.exit()
            if event.type == KEYUP:
                    if event.key == ord('m'):
                       if musicPlaying:
                               pygame.mixer.music.stop()
                       else:
                               pygame.mixer.music.play(-1, 0.0)
                       musicPlaying = not musicPlaying
                    if event.key == ord('s'):
                       soundBoolean = not soundBoolean
                    if event.key == K_1:
                            pygame.mixer.music.stop()
                            set_musik(1)
                            pygame.mixer.music.play(-1, 0.0)
                    if event.key == K_2:
                            pygame.mixer.music.stop()
                            set_musik(2)
                            pygame.mixer.music.play(-1, 0.0)
                    if event.key == K_3:
                            pygame.mixer.music.stop()
                            set_musik(3)
                            pygame.mixer.music.play(-1, 0.0)
                    if event.key == K_h:
                            playerspeed=500
                            startspeed=250
                    if restartBoolean:
                            if event.key == K_SPACE:
                                    player_a = 0
                                    player_b = 0
                                    speed = startspeed
                                    ball_x = 302
                                    ball_y = 162
                                    restartBoolean = False
##            if event.type == KEYDOWN:
##                    if event.key == K_DOWN and b_y + 95 < 360:
##                            b_y += seconds * playerspeed * 1
##                    if event.key == K_UP and b_y > 0:
##                            b_y += seconds * playerspeed * -1

    key_pressed = pygame.key.get_pressed()

    if key_pressed[K_DOWN] and b_y + 95 < 360:
        b_y += seconds * playerspeed * 1
    if key_pressed[K_UP] and b_y > 0:
        b_y += seconds * playerspeed * -1

    screen.blit(background, (0,0))
    screen.blit(playeraText, playeraTextRect)
    screen.blit(playerbText, playerbTextRect)


    balken_a_pos = (a_x, a_y)
    balken_b_pos = (b_x, b_y)
    draw_punkte(player_a, player_a_pkt_pos)
    draw_punkte(player_b, player_b_pkt_pos)

    screen.blit(balken, balken_a_pos)
    screen.blit(balken, balken_b_pos)
    screen.blit(ball, ball_position)

    milli = clock.tick()
    seconds = milli/1000.

    dmx = seconds * speed * ball_dir_leftright
    dmy = seconds * speed * ball_dir_updown
    ball_x += dmx
    ball_y += dmy + winkel

    ball_position = (ball_x,ball_y)

    # ball hits player a
    if object_hit(ball_position, ball_gr, balken_a_pos, balken_gr, seconds):
            change_direction()
            change_angle()
    # ball hits player b
    elif object_hit(ball_position, ball_gr, balken_b_pos, balken_gr, seconds):
            change_direction()
            change_angle()

    ball_hit_wall(ball_position, ball_gr)

    move_player_a(ball_y)

    if player_a == 5 or player_b == 5:
            speed = 0
            if player_a == 5:
                    winTextRect.x = 80
                    looseTextRect.x = 450
            else:
                    winTextRect.x = 450
                    looseTextRect.x = 80
            looseTextRect.y = 160
            winTextRect.y = 160
            screen.blit(winText, winTextRect)
            screen.blit(looseText, looseTextRect)
            restartBoolean = True

    if restartBoolean:
            screen.blit(startText, startTextRect)
            screen.blit(musicText, musicTextRect)
            screen.blit(soundText, soundTextRect)
            screen.blit(backText, backTextRect)

    pygame.display.flip()

Of course you will have to come up with your own pictures and background picture to make the previous code work but it does run

A pong game requires (like any other game) planning. Even though it is the simplest game to write, it can be frustrating if you don't aquire knowledge on how the game works. I know, I know, you're thinking what more can be to it than just the ball moving around, and two paddles hitting it back and forth? Well there are a lot of dynamics in the game that simple developers would realize, and sometimes even advanced developers look over it.

Basically there a few things you will need for each object in the game:
Player: Location, Sprite, MoveSpeed, Score
Computer: Location, Sprite, MoveSpeed, Score, BallLocation, DistanceDetection (usually a float value for pixels)
Ball: Location, Sprite, MoveSpeed, Velocity

General: Screen Width, Screen Height, Player/Computer Sprite Widths

The workings of the player is very simple. If the player inputs the button or key (or other action) to move up or down, we simulate the paddle doing so. So for example in pseudocode:

// Psuedocode (C++ Syntax):
const int MoveSpeed = 5;
VectorVariableType Location;

const int ScreenWidth = 0;
const int ScreenHeight = 0;

// Update player movement:
Location.Y += MoveUpCondition ? -5 : 5;

With the computer we would just detect how far away the ball is to see if we should move the paddle to try and hit it. So in pseudocode:

// Pseudocode (C++ Syntax):
VectorVariableType Location;

BallVariable Ball;

const int ScreenWidth = 0;
const int ScreenHeight = 0;

const float DetectionDistance = 100f;

// Check distance:
Location.Y = Ball.Location.X >= ScreenWidth - DetectionDistance ? Ball.Location.Y : Location.Y;

You can also make it move at a specific rate, but I just make it follow the ball after it gets so close.

With the ball it gets a little more complex. We need a function to spawn the ball after it goes off the screen, as well as to randomize the direction in which it travels. Pseudocode example:

Psuedocode (C++ Syntax):
const int MoveSpeed = 5;
VectorVariableType Location;
VectorVariableType Velocity;

PlayerVariable Player;
ComputerVariable Computer;

const int ScreenWidth = 0;
const int ScreenHeight = 0;

const int BallWidth = 20;
const int BallHeight = 20;

void Spawn() {
    int Random = // generate random number between 1 and 4.

    // Handle each outcome for direction:
    switch (Random) {
        case 1: Velocity = new VectorVariableType(MoveSpeed, MoveSpeed); break;
        case 2: Velocity = new VectorVariableType(-MoveSpeed, -MoveSpeed); break;
        case 3: Velocity = new VectorVariableType(-MoveSpeed, MoveSpeed); break;
        case 4: Velocity = new VectorVariableType(MoveSpeed, -MoveSpeed); break;
    }

    // Reset location to center of the screen.
    Location = new VectorVariableType(ScreenWidth / 2, ScreenHeight / 2);
}


// Update the ball:
Location += Velocity;

// Check left wall for scoring
if (Location.X < 0)
    Computer.Score++;

// Check right wall for scoring
if (Location.X > ScreenWidth)
    Player.Score++;

// Check top and bottom for inverting Y.
Velocity.Y = Location.Y <= 0 || Location.Y + BallHeight >= ScreenHeight ? -Velocity.Y : Velocity.Y;

That's your basic inner workings of a simple pong game. It takes a little longer than we all think to write it, but no where near as long as some of the more complex games like Pacman, Tetris, Space Invaders, etc.

Hope it helps,
Jamie

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.