Lewis Cheadle 201245660

Dependencies:   mbed

Revision:
13:fd290d2fd917
Parent:
8:10eb578dd754
--- a/Ball/Ball.cpp	Tue May 26 18:16:31 2020 +0000
+++ b/Ball/Ball.cpp	Tue May 26 22:41:23 2020 +0000
@@ -10,7 +10,7 @@
 
 }
 
-
+//Initialises the ball sprite and the initial co-ords of the ball
 void Ball::init(int x,int y)
 {
     int ball[2][2] = {
@@ -22,12 +22,15 @@
 
 }
 
-
+//Takes x and y co-ordinates and draws the ball at that position.
 void Ball::draw(N5110 &lcd)
 {
     lcd.drawSprite(ball_x_pos,ball_y_pos,2,2,(int *)ball);
 }
 
+//Takes the inputs of the gamepad and updates the x and y co-ords based on the
+//direction of the joystick and whether button A has been pressed.
+//Pressing A double the speed of the ball.
 void Ball::update(Direction d,Gamepad &pad)
 {
     
@@ -87,6 +90,7 @@
     
 }
 
+//Functions to return the x and y co-ords of the ball
 int Ball::get_ball_x_pos(){
     return ball_x_pos;
     }
@@ -95,6 +99,7 @@
     return ball_y_pos;
     }
 
+//When a level has been completed, resets the balls co-ords
 void Ball::level_finish(){
     ball_x_pos = 0;
     ball_y_pos = 21;