Similar to the example code.

Dependencies:   mbed N5110

Revision:
0:97418ec4c37d
Child:
1:85ab0d979b57
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Bird/Bird.cpp	Tue Apr 23 16:04:18 2019 +0000
@@ -0,0 +1,57 @@
+#include "Bird.h"
+
+void Bird::init()
+{
+    _y = 20;
+    _head = 24;
+    _speed = 4;
+
+}
+
+
+void Bird::draw(N5110 &lcd)
+{
+    lcd.drawRect(0, _y, 4, 3, FILL_BLACK);
+    lcd.setPixel(4, _y+1, true);
+    lcd.setPixel(1,_head,true);
+    lcd.setPixel(2,_head,true);
+
+}
+
+void Bird::update(Gamepad &pad)
+{
+    if(pad.check_event(Gamepad::A_PRESSED)) {
+        _y -= 4;
+        _head = _y-1;
+    } else {
+        _y += _speed;
+        _head = _y+3;
+    }
+}
+
+
+void Bird::background(N5110 &lcd)
+{
+    lcd.inverseMode();
+    wait(0.2);
+    lcd.normalMode();
+    wait(0.2);
+    lcd.inverseMode();
+    wait(0.2);
+    lcd.normalMode();
+    wait(0.2);
+
+}
+
+
+
+int Bird::get_y ()
+{
+    return _y;
+}
+
+
+
+
+
+