// Ball.h -- written 16 Mar 1996 by Max Hailperin // // The Ball class is for the moving ball in the Photon game. // It has an (x,y) position measured in units of the playing fields "cells", // i.e., the basic grid, and it has a direction of motion specified through // two separate settings -- vertical and direction. If vertical is 1, then // the ball is moving up or down, while if it is 0, then the ball is moving // left or right. If direction is 1, then the ball is moving up or right, // while if direction is -1, then the ball is moving down or left. #ifndef BALL_H #define BALL_H class Photon; class Ball{ public: Ball(Photon *, int x, int y, int direction, int vertical); // draws ball too void move(); // moves the ball one cell in the appropriate direction int x() {return xpos;} int y() {return ypos;} int direction() {return dir;} void direction(int newDir) {dir = newDir;} int vertical() {return vert;} void vertical(int newVert) {vert = newVert;} ~Ball(); // also erases the ball protected: Photon *game; int xpos, ypos, dir, vert, id; }; #endif