Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 8:421f94b816c4
- Parent:
- 7:ffbc921c20f7
- Child:
- 9:e6832bf222b7
--- a/main.cpp Tue May 07 15:33:17 2019 +0000
+++ b/main.cpp Tue May 07 16:02:12 2019 +0000
@@ -12,12 +12,12 @@
*/
#include "main.h"
-
N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
Gamepad pad;
Options opt;
Donkey dky;
GameEngine eng;
+Barrel barrel;
int fps = 24;
int direction;
@@ -44,6 +44,7 @@
lcd.clear();
lcd.printString("Game",0,0);
dky.donkeykong_movement(pad, lcd);
+ barrel.barrel_drop(pad, lcd);
wait_ms(1.0f/fps);
}
}
@@ -87,6 +88,27 @@
}
}
// Barrel -----------
+int barrel_x = 0;
+int barrel_y = 0;
+int barrel_speed = 0;
+int barrel_min = 0;
+int barrel_max = 76;
+
+Barrel::Barrel()
+{
+
+}
+
+Barrel::~Barrel()
+{
+
+}
+
+void Barrel::barrel_drop(Gamepad &pad, N5110 &lcd) {
+ barrel_x = rand() % (barrel_max + 1 - barrel_min) + barrel_min;
+ lcd.drawSprite(barrel_x,barrel_y,4,8,(int *)game_barrel);
+ lcd.refresh();
+}
// Banana -----------