Nemesis game, stats

Revision:
5:b822aaa6200d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Ship1.cpp	Sat Apr 01 11:43:25 2017 +0000
@@ -0,0 +1,62 @@
+#include "Ship1.h"
+
+Ship1::Ship1()
+{
+
+}
+
+Ship1::~Ship1()
+{
+
+}
+
+void Ship1::init(int size,int speed)
+{
+    _size = size;
+    
+    int x = rand() % 63 + 84;
+    _x = x;
+    _y = 1;
+
+    _velocity.x = -speed;
+    _velocity.y = 0;
+}
+
+void Ship1::draw(N5110 &lcd)
+{
+    lcd.drawLine(_x,_y,_x,_y+5,1);
+    lcd.drawLine(_x-1,_y,_x-1,_y+5,1);
+    lcd.drawLine(_x-2,_y+1,_x-2,_y+4,1);
+    lcd.drawLine(_x-3,_y+1,_x-3,_y+4,1);
+    lcd.drawLine(_x-4,_y+2,_x-4,_y+3,1);
+}
+
+void Ship1::update()
+{
+    _x += _velocity.x;
+    _y += _velocity.y;
+}
+
+void Ship1::set_velocity(Vector2D v)
+{
+    _velocity.x = v.x;
+    _velocity.y = v.y;
+}
+
+Vector2D Ship1::get_velocity()
+{
+    Vector2D v = {_velocity.x,_velocity.y};
+    return v;
+}
+
+Vector2D Ship1::get_pos()
+{
+    Vector2D p = {_x,_y};
+    return p;
+}
+
+void Ship1::set_pos(Vector2D p)
+{
+    _x = p.x;
+    _y = p.y;
+}
\ No newline at end of file