Introduction
Statistics
Contact
Development
Disclaimer
Help
sdf.org home page
/*
* File: paddle.h
* Purpose: Contains the prototype for the paddle class
* for the game of pong.
*/
#ifndef PADDLE_H
#define PADDLE_H
#include "ball.h"
#define PADDLE_HEIGHT 5
class Paddle {
public:
//constructor
Paddle(int player);
//movement functions
void moveUp();
void moveDown();
//collision detection
bool checkCollision(Ball b);
//screen commands
void draw();
void erase();
void update();
//report position
int getX();
int getY();
private:
int x, y;
/*
Paddle position specified by:
#
#
# <-- (x,y)
#
#
*/
};
class PlayerPaddle : public Paddle {
public:
PlayerPaddle(int player);
void update(); //overrides parent update
};
class ComputerPaddle : public Paddle {
public:
ComputerPaddle(int player);
void update(int ballY);
};
#endif