Kern Fowler / Mbed 2 deprecated Donkey_Kong_Game

Dependencies:   mbed

Revision:
33:3894a7f846a0
Parent:
20:c4e6941c98e2
Child:
35:68c3c06d67a8
--- a/lib/Donkey/Donkey.h	Wed May 08 23:46:49 2019 +0000
+++ b/lib/Donkey/Donkey.h	Thu May 09 10:46:03 2019 +0000
@@ -38,6 +38,29 @@
 *@param pad The Gamepad class is used.
 *@param lcd The N5110 class is used.
 *@details Creates the player controlled unit Donkey Kong, then moves it left or right based on joystick input. Points on collision with bananas. Gameover on collision with barrels.
+*@code
+void Donkey::donkeykong_movement(Gamepad &pad, N5110 &lcd) {
+    donkey_direction = pad.get_direction();
+        if (donkey_direction == NE || donkey_direction == E || donkey_direction == SE) { // If joystick moved right, the right position sprite will be loaded and donkey kong will move right.
+            donkeykong_x = donkeykong_x + 3;
+            lcd.drawSprite(donkeykong_x,donkeykong_y,14,16,(int *)game_dk_walking_right_1);
+        } 
+        else if (donkey_direction == NW || donkey_direction == W || donkey_direction == SW) { // If joystick moved left, the left position sprite will be loaded and donkey kong will move left.
+            donkeykong_x = donkeykong_x - 3;
+            lcd.drawSprite(donkeykong_x,donkeykong_y,14,16,(int *)game_dk_walking_left_1);
+        } 
+        else { // If joystick not moved, then stationary sprite will be loaded and no movement occurs.
+            lcd.drawSprite(donkeykong_x,donkeykong_y,14,16,(int *)game_dk_stationary); 
+        }
+        lcd.refresh();
+        if (donkeykong_x > 68) { // Stops donkey kong model going off screen. 
+            donkeykong_x = 68;
+        }
+        if (donkeykong_x < 0) {
+            donkeykong_x = 0;
+        }
+}
+@endocde
 */
 void donkeykong_movement(Gamepad &pad, N5110 &lcd);
 };