Nemesis game, stats

Revision:
6:fb678d095e0a
Parent:
5:b822aaa6200d
diff -r b822aaa6200d -r fb678d095e0a Bullet.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Bullet.cpp	Sun Apr 02 17:47:38 2017 +0000
@@ -0,0 +1,57 @@
+#include "Bullet.h"
+
+Bullet::Bullet()
+{
+
+}
+
+Bullet::~Bullet()
+{
+
+}
+
+void Bullet::init(N5110 &lcd, Gamepad &pad, int speed)
+{   
+    Vector2D friendly_pos = _friendly.get_pos();
+    
+    _x = friendly_pos.x+6;
+    _y = friendly_pos.y+3;
+
+    _velocity.x = speed;
+    _velocity.y = 0;
+}
+
+void Bullet::draw(N5110 &lcd)
+{
+    lcd.setPixel(_x,_y);
+}
+
+void Bullet::update()
+{
+    _x += _velocity.x;
+    _y += _velocity.y;
+}
+
+void Bullet::set_velocity(Vector2D v)
+{
+    _velocity.x = v.x;
+    _velocity.y = v.y;
+}
+
+Vector2D Bullet::get_velocity()
+{
+    Vector2D v = {_velocity.x,_velocity.y};
+    return v;
+}
+
+Vector2D Bullet::get_pos()
+{
+    Vector2D p = {_x,_y};
+    return p;
+}
+
+void Bullet::set_pos(Vector2D p)
+{
+    _x = p.x;
+    _y = p.y;
+}
\ No newline at end of file