Nemesis game, first enemy

Revision:
7:3d951a743dbe
Child:
8:2ced844d8292
diff -r a0da5659225d -r 3d951a743dbe Enemy1.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Enemy1.cpp	Tue May 02 22:13:59 2017 +0000
@@ -0,0 +1,42 @@
+#include "Enemy1.h"
+
+Enemy1::Enemy1()
+{
+
+}
+
+Enemy1::~Enemy1()
+{
+
+}
+
+void Enemy1::init(int speed)
+{   
+    int x = rand() % 63 + 84;
+    _x = x;
+    _y = 1;
+
+    _velocity.x = -speed;
+    _velocity.y = 0;
+}
+
+void Enemy1::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 Enemy1::update()
+{
+    _x += _velocity.x;
+    _y += _velocity.y;
+}
+
+Vector2D Enemy1::get_pos()
+{
+    Vector2D p = {_x,_y};
+    return p;
+}
\ No newline at end of file