FINAL VERSION

Dependencies:   mbed

Revision:
114:280903dd7e06
Child:
136:04a2724f90cf
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Life_Powerup/Life_Powerup.cpp	Wed May 08 13:08:55 2019 +0000
@@ -0,0 +1,51 @@
+#include "Life_Powerup.h"
+
+Life_Powerup::Life_Powerup()
+{
+
+}
+
+Life_Powerup::~Life_Powerup()
+{
+
+}
+
+void Life_Powerup::init()  // initialises the Life_Powerup off screen
+{
+    _x = -10;  
+    _y = 0;
+    _speed_y = 1; // -2 speed in the y direction, doesnt change even off screen
+}
+
+void Life_Powerup::draw(N5110 &lcd)
+{   
+    if (_x >= 0) {  // only draw if on screen (more efficient?)
+        Bitmap powerup(powerup_data, 9, 9);  // assign the powerup sprite data
+        powerup.render(lcd,_x,_y);
+    }
+}
+
+void Life_Powerup::update() // updates the Life_Powerup's y coordinate according to its speed
+{
+    _y += _speed_y;
+}
+
+int Life_Powerup::get_x()  // retrieves the Life_Powerups's x coordinate
+{
+    return _x;
+}
+
+int Life_Powerup::get_y()  // retrieves the Life_Powerups's y coordinate
+{
+    return _y;
+}
+
+void Life_Powerup::set_posx(int x)  // sets the Life_Powerup's x coordinate
+{
+    _x = x;
+}
+
+void Life_Powerup::set_posy(int y)  // sets the Life_Powerups's y coordinate
+{
+    _y = y;
+}
\ No newline at end of file