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.
Dependencies: mbed
Diff: ModeA/ModeA.cpp
- Revision:
- 0:15b74f0f8c7f
- Child:
- 1:44f4594eacac
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ModeA/ModeA.cpp Wed May 08 14:50:07 2019 +0000
@@ -0,0 +1,69 @@
+#include "ModeA.h"
+
+ModeA::ModeA()
+{
+
+}
+
+ModeA::~ModeA()
+{
+
+}
+
+void ModeA::screen(N5110 &lcd)
+{
+
+ lcd.clear();
+ lcd.printString("GAME",0,0);
+ lcd.printString("Back:Rules",0,2);
+
+ };
+
+ void ModeA::initialise(N5110 &lcd)
+ {
+ x_position = 5;
+ y_position = 18;
+ speed = 0;
+ gravity = 1;
+ }
+
+
+void ModeA::Bird(N5110 &lcd)
+
+{
+
+
+ lcd.drawRect(x_position, y_position,6,6,FILL_BLACK);
+ lcd.drawRect(10,5,7,7,FILL_BLACK);
+ lcd.refresh();
+
+
+
+ if ( pad.check_event(Gamepad::Y_PRESSED) == true) {
+
+ speed = speed - gravity*5;
+
+ }
+
+ if (y_position > 42) {
+ y_position = 42;
+ speed = 0;
+ }
+
+ if (y_position < 0) {
+ y_position = 0;
+ speed = 0;
+ }
+
+ speed = speed + gravity;
+ y_position = y_position + speed;
+ wait(0.1);
+
+
+ }
+
+
+
+
+
+
\ No newline at end of file