Projectile Library

Projectile.cpp

Committer:
ll14c4p
Date:
2017-04-24
Revision:
1:2aee0cb1ebf9
Parent:
0:6914458c54cd
Child:
2:b079859c59ba

File content as of revision 1:2aee0cb1ebf9:

#include "Projectile.h"
#include "Player.h"

Projectile::Projectile()
{

}

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;
}