Projectile Library
Diff: Projectile.cpp
- Revision:
- 1:2aee0cb1ebf9
- Parent:
- 0:6914458c54cd
- Child:
- 2:b079859c59ba
--- a/Projectile.cpp Mon Apr 24 11:06:14 2017 +0000 +++ b/Projectile.cpp Mon Apr 24 13:35:08 2017 +0000 @@ -1,4 +1,5 @@ #include "Projectile.h" +#include "Player.h" Projectile::Projectile() { @@ -8,4 +9,48 @@ Projectile::~Projectile() { +} + +void Projectile::init(int size,int speed) +{ + _size = 1; + //Make intial position of projectile = centre of player + + + +} + +void Projectile::draw(N5110 &lcd) +{ + lcd.drawRect(_x,_y,_size,_size,FILL_BLACK); +} + +void Projectile::update() +{ + _x += _velocity.x; + _y += _velocity.y; +} + +void Projectile::set_velocity(Vector2D v) +{ + _velocity.x = v.x; + _velocity.y = v.y; +} + +Vector2D Projectile::get_velocity() +{ + Vector2D v = {_velocity.x,_velocity.y}; + return v; +} + +Vector2D Projectile::get_pos() +{ + Vector2D p = {_x,_y}; + return p; +} + +void Projectile::set_pos(Vector2D p) +{ + _x = p.x; + _y = p.y; } \ No newline at end of file