Rex Raj / Mbed 2 deprecated el17rrrs

Dependencies:   mbed Gamepad N5110 mbed-rtos

Revision:
0:99fa5a619081
Child:
4:4d673fb2d9dc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Enemy/Enemy.cpp	Sat Apr 13 01:13:53 2019 +0000
@@ -0,0 +1,85 @@
+#include "Enemy.h"
+
+// nothing doing in the constructor and destructor
+Enemy::Enemy()
+{
+
+}
+
+Enemy::~Enemy()
+{
+
+}       
+
+int enemy1 [7][8] = {
+   
+{0,1,1,0,0,0,0,1},
+{0,0,0,1,1,1,1,1},
+{0,0,1,0,0,1,1,0},
+{0,1,0,0,1,1,1,0},
+{0,0,1,0,0,1,1,0},
+{0,0,0,1,1,1,1,1},
+{0,1,1,0,0,0,0,1},
+
+};
+
+//int boss [13][13] = {
+    
+//{0,0,0,0,0,1,1,1,1,1,0,0,0},
+//{0,0,0,0,0,0,1,1,1,0,0,0,0},
+//{0,0,1,1,1,1,1,1,1,1,1,1,1},
+//{0,0,0,0,0,1,0,1,0,0,1,0,0},
+//{0,0,0,0,1,0,1,0,1,0,1,0,0},
+//{0,0,0,1,0,0,0,1,0,1,1,0,0},
+//{1,1,1,1,0,1,0,1,0,1,1,0,0},
+//{0,0,0,1,0,0,0,1,0,1,1,0,0},
+//{0,0,0,0,1,0,1,0,1,0,1,0,0},
+//{0,0,0,0,0,1,0,1,0,0,1,0,0},
+//{0,0,1,1,1,1,1,1,1,1,1,1,1},
+//{0,0,0,0,0,0,1,1,1,0,0,0,0},
+//{0,0,0,0,0,1,1,1,1,1,0,0,0},    
+
+//};
+
+   
+
+void Enemy::init(int a,int b)
+{
+  
+    _a = a;
+    _b = b;
+    _health = 0;  // start health from zero
+
+}
+
+void Enemy::enemy(N5110 &lcd)
+{
+
+    // draw the first enemy
+    lcd.drawSprite(_a,_b,7,8,(int *)enemy1);
+}
+
+void Enemy::update()
+{
+    _speed = 2.0;  // scale is arbitrary, could be changed in future
+
+    // update y value depending on direction of movement
+    // North is decrement as origin is at the top-left so decreasing moves up
+        _b+=_speed;
+  
+  
+}
+void Enemy::add_health()
+{
+    _health++;
+}
+int Enemy::get_health()
+{
+    return _health;
+}
+
+
+Vector2D Enemy::get_enemy_pos() {
+    Vector2D e = {_a,_b};
+    return e;    
+}
\ No newline at end of file