Isabel Cousins / PlayerChar

Files at this revision

API Documentation at this revision

Comitter:
isabelc
Date:
Tue May 02 14:46:26 2017 +0000
Parent:
10:cfeef15cce27
Child:
12:9bc551a4cab9
Commit message:
Doxygen commenting and other comments added throughout

Changed in this revision

PlayerChar.cpp Show annotated file Show diff for this revision Revisions of this file
PlayerChar.h Show annotated file Show diff for this revision Revisions of this file
--- a/PlayerChar.cpp	Mon May 01 15:54:55 2017 +0000
+++ b/PlayerChar.cpp	Tue May 02 14:46:26 2017 +0000
@@ -25,29 +25,43 @@
 
 int _x = 10;
 
+/** Update
+*
+*   Prints the speech at the start of the game.
+*   @param lcd - a reference to the instance of N5110 screen
+*   @param pad - a reference to the instance of the gampad library 
+*/
 void PlayerChar::update(N5110 &lcd, Gamepad &pad)
 {
     float _d = pad.get_direction();
+    //printf("Direction from joystick: %I", _d);
 
-    // update x value depending on direction of movementmof joystick
+    // update x value depending on direction of movement of joystick
     // West is decrement as origin is at the top-left so decreasing moves left
     if (_d == W) {
         _x = _x - 3;
     } else if (_d == E) {
         _x = _x + 3;
     }
+    //printf("_x value: %I", _x);
+    
     // check the x origin to ensure that the character doesn't go off screen
-    if (_x < 2) {
-        _x = 2;
+    if (_x < 2) { 
+        _x = 2; //if attempts to move left place at edge of screen
+    } else if (_x > 76) {
+        _x = 76; //if attempts to move right place at edge of screen
     }
-    if (_x > 76) {
-        _x = 76;
-    }
+    //printf(_x value after limits: %I", _x);
+    
     detective1.render(lcd, _x, 30);
-
 }
 
+/** Get Detective X Positon
+*
+*   Returns the x value of the player character.
+*/
 int PlayerChar::getdex()
 {
     return _x;
+    //printf("X value of player character in PlayerChar class: %I");
 }
\ No newline at end of file
--- a/PlayerChar.h	Mon May 01 15:54:55 2017 +0000
+++ b/PlayerChar.h	Tue May 02 14:46:26 2017 +0000
@@ -6,6 +6,15 @@
 #include "Gamepad.h"
 #include "Bitmap.h"
 
+/** Player Character Class
+
+@brief Class containg bitmap for the player character.
+@brief Covers rendering the bitmap and charcter movement.
+
+@author Isabel Cousins
+@date 2nd May 2017
+
+*/
 class PlayerChar{
     public: