Kern Fowler / Mbed 2 deprecated Donkey_Kong_Game

Dependencies:   mbed

Revision:
25:0ba3524ee0b7
Parent:
19:8400ecdb69e9
Child:
39:1d0584a152a6
--- a/lib/Barrel/Barrel.h	Thu May 09 00:33:19 2019 +0000
+++ b/lib/Barrel/Barrel.h	Thu May 09 00:36:51 2019 +0000
@@ -26,7 +26,7 @@
 
 public:
 /** Barrel Constructor 
-@brief Builds my default Barrel constructor.
+@brief Builds my default Barrel contructor.
 @details This does not have any setup. 
 */
 Barrel();
@@ -43,6 +43,23 @@
 *@param lcd The N5110 class is used.
 *@param dky The Donkey class is used.
 *@details Spawns a barrel at a random x location, then slowly falls down screen. When reaches bottom it restarts. If collision with player leads to gameover.
+*@code
+void Barrel::barrel_drop(Gamepad &pad, N5110 &lcd, Donkey &dky) {
+    lcd.drawSprite(barrel_x,barrel_y,4,8,(int *)game_barrel); // Draws the barrel sprite on screen with correct coordinates.
+    lcd.refresh();
+    wait_ms(50);
+    barrel_y = barrel_y + 1 + barrel_time;
+    if (barrel_y > 44) { // If barrel reaches bottom of the screen, the resets.
+        barrel_y = 0;
+        barrel_x = rand() % (barrel_max + 1 - barrel_min) + barrel_min;
+        barrel_time = barrel_time + 0.1; // Moves barrel slowly down screen.
+    }
+    if ((barrel_y >= 34) & ((barrel_x + 7) >= donkeykong_x) & (barrel_x <= (donkeykong_x + 15))) { // If barrel collides with player then sets running to 0, causing gameover.
+        running = 0;
+        //printf("Barrel Hit")
+    }
+}
+@endcode
 */
 void barrel_drop(Gamepad &pad, N5110 &lcd, Donkey &dky);
 };