Li Ruofan 201199450

Dependencies:   mbed

shot/shot.cpp

Committer:
DannyLee
Date:
2020-05-15
Revision:
7:e3844250b77d
Parent:
6:cbd9e1f26a10

File content as of revision 7:e3844250b77d:

#include "shot.h"

Shot::Shot()
{

}

Shot::~Shot()
{

}


void Shot::init(int x,int y,int width,int height, int velocity)
{
    _x = x;
    _y = y; //set position of shot
    _width = width;
    _height = height;
    _speed = 3;
}

void Shot::draw(N5110,lcd)
{
    int Shot[3][5] = {
     0,1,0 ,
     1,1,1 ,
     0,1,0 ,
     1,1,1 ,
     1,1,1 , 
};
    Bitmap sprite(Shot, _width, _height); 
    sprite.render(lcd, _x, _y); 
}

void Shot::update()
{
    _y-=_speed;
}
 
Vector2D Bullet::get_Pos()
{
    Vector2D p = {_x,_y};
    return p;
}