Simple Pong game on NokiaLCD with PS2

Dependencies:   mbed PS2 NokiaLCD

Revision:
1:3cc8b1413557
Parent:
0:93dce1e528b9
--- a/ball.cpp	Sun Feb 27 23:35:17 2011 +0000
+++ b/ball.cpp	Mon Feb 28 00:12:36 2011 +0000
@@ -8,11 +8,22 @@
 Ball::Ball(int x, int y, int w, int h, int c, int xi, int yi)
  : x(x), y(y), width(w), height(h), color(c), xInc(xi), yInc(yi) {}
  
+ 
+/* 
+ * Member Function move:
+ * Description: Colors in the previous ball black
+ *  and moves ball to new position.
+ */
 void Ball::move(NokiaLCD &lcd) {
-  lcd.fill(x,y,width,height,0x000000);
+  draw(lcd, true);
   x += xInc; y += yInc;
 }
 
+/* 
+ * Member Function draw:
+ * Description: Draws object on screen
+ *  if isBlack, color in black.
+ */
 void Ball::draw(NokiaLCD &lcd, bool isBlack) const {
   lcd.fill(x, y, width, height, (isBlack) ? 0x000000 : color);
 }
@@ -36,7 +47,14 @@
 bool Ball::hitY() {
   return (y<=0) || (y+height>=130);
 }
-  
+
+/* 
+ * Member Function hitP1:
+ * Description: Checks to see if there is
+ *  a collision between paddle1 and the ball.
+ *  Has special functionality for changing
+ *  y-incline based on collision point.
+ */
 bool Ball::hitP1(int _x, int _y, int _height) {
   bool hit = ((_x>=x) && (xInc<0)) && 
          (((_y<=y) && (_y+_height>=y+height)) ||
@@ -51,6 +69,14 @@
   return hit;
 }
 
+
+/* 
+ * Member Function hitP2:
+ * Description: Checks to see if there is
+ *  a collision between paddle2 and the ball.
+ *  Has special functionality for changing
+ *  y-incline based on collision point.
+ */
 bool Ball::hitP2(int _x, int _y, int _height) {
   bool hit = ((_x<=x+width) && (xInc>0)) && 
          (((_y<=y) && (_y+_height>=y+height)) ||