ELEC2645 (2019/20) / Mbed 2 deprecated ELEC2645_Project_el18jkeo

Dependencies:   mbed

BulletS/BulletS.cpp

Committer:
josh_ohara
Date:
2020-03-23
Revision:
6:5bea67cc96f9
Parent:
5:e5bb95fb308b
Child:
7:06a2558155f0

File content as of revision 6:5bea67cc96f9:

#include "BulletS.h"

Bullet::Bullet()
{
}

void Bullet::init(int size, int x, int y)  {
    Size = size;
    Speed = 0;
    X = x;                                      //x=Middle of the ship
    Y = HEIGHT;                                      //y=Top of the ship Height is ship Height
}

void Bullet::draw(N5110 &lcd)
{
    lcd.drawRect(X,Y,Size,Size,FILL_BLACK);
}

void Bullet::update() {
    if(pad.A_pressed()) {
        Speed = 1;                            //shoots bullet if pad a pressed
        Y -= Speed;
    } 
}
    
Vector2D Bullet::get_position() {
    Vector2D p = {X,Y};
    return p;    
}

//void Bullet::set_hit(bool hit) {
//    bool Hit == hit;
//}