deemo1

Dependencies:   mbed

Revision:
4:9fa0c5edd1a1
Child:
5:32dbfaf578dd
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Acid/Acid.cpp	Tue May 12 15:54:51 2020 +0000
@@ -0,0 +1,73 @@
+#include "Acid.h"
+
+Acid::Acid()
+{
+    
+}
+
+Acid::~Acid()
+{
+    
+}
+
+void Acid::init(int height,int width,int speed)
+{
+     Vector2D Boss_pos = _Boss.get_pos();
+     _width = width;
+     _height = height;
+     // Set Acid's position
+     _x = Boss_pos.x + 3;
+     _y = Boss_pos.y + 5; 
+     
+     srand(time(NULL));
+     
+     _velocity.x = 0;
+     _velocity.y = -1.2*speed;
+     
+}
+
+void Acid::draw(N5110 &lcd)
+{   
+    lcd.drawRect(_x,_y,_width,_height,FILL_BLACK);
+}
+
+void Acid::update()
+{
+     _x += _velocity.x;
+     _y += _velocity.y;
+}
+
+void Acid::set_velocity(Vector2D v)
+{
+    _velocity.x = v.x;
+    _velocity.y = v.y;
+}
+
+Vector2D Acid::get_velocity()
+{
+    Vector2D v = {_velocity.x,_velocity.y};
+    return v;
+}
+ 
+Vector2D Acid::get_pos()
+{
+    Vector2D p = {_x,_y};
+    return p;
+}
+ 
+void Acid::set_pos(Vector2D p)
+{
+    _x = p.x;
+    _y = p.y;
+}
+
+
+
+
+
+
+
+
+
+     
+     
\ No newline at end of file