ELEC2645 (2018/19) / Mbed 2 deprecated fy14lkaa

Dependencies:   mbed

Revision:
105:b206078335a3
Parent:
102:d5c235fb27fd
Child:
106:73d5d818ae7d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Spaceship/Spaceship.cpp	Sun May 05 13:17:31 2019 +0000
@@ -0,0 +1,63 @@
+#include "Spaceship.h"
+
+Space_ship::Space_ship()
+{
+
+}
+
+Space_ship::~Space_ship()
+{
+
+}
+
+
+
+
+const int Space_ship[10][12]= {
+    {0,0,0,0,0,0,0,0,0,0,0,0},
+    {0,0,0,1,1,0,0,0,0,0,0,0},
+    {0,0,0,1,1,0,0,0,0,0,0,0},
+    {0,1,1,1,1,1,1,1,0,0,0,0},
+    {0,1,1,1,1,1,1,1,1,0,0,0},
+    {0,1,1,1,1,1,1,1,1,1,1,0},
+    {0,1,1,1,1,1,1,1,1,0,0,0},
+    {0,1,1,1,1,1,1,1,0,0,0,0},
+    {0,0,0,1,1,0,0,0,0,0,0,0},
+    {0,0,0,1,1,0,0,0,0,0,0,0},
+
+};
+
+void Space_ship::init(int x,int height,int width)
+{
+    _x = x;  // x value on screen is fixed
+    _y = HEIGHT/2 - height/2;  // y depends on height of screen and height of Space_ship
+    _height = height;
+    _width = width;
+    _speed = 1;  // default speed
+    _score = 0;  // start score from zero
+
+
+
+}
+
+void Space_ship::draw(N5110 &lcd)
+{
+    // draw Space_ship in screen buffer.
+    lcd.drawSprite(x_Space_ship,y_Space_ship,10,12,(int *) Space_ship);
+}
+
+void Space_ship::add_score()
+{
+    _score++;
+}
+
+int Space_ship::get_score()
+{
+    return _score;
+}
+
+Vector2D Space_ship::get_pos()
+{
+    Vector2D p = {_x,_y};
+    return p;
+}
\ No newline at end of file