Joshua O'hara 201291390

Dependencies:   mbed

AlienBullet/AlienBullet.cpp

Committer:
josh_ohara
Date:
2020-05-01
Revision:
16:987f72d9bb8f
Child:
18:828e9f6ddfdb

File content as of revision 16:987f72d9bb8f:

#include "AlienBullet.h"

AlienBullet::AlienBullet()
{
}
AlienBullet::~AlienBullet()
{
}

void AlienBullet::init(int x, int y)  {
    Speed = 1;
    Hit = false;
    X = x;                                      //x=Middle of the ship
    Y = y;    
                                      //y=Top of the ship Height is ship Height
}

void AlienBullet::render(N5110 &lcd)
{
    if(Hit == false) {
        lcd.setPixel(X,Y,true);
    }
}

void AlienBullet::update(Gamepad &pad,N5110 &lcd) {
    Y+= Speed;
}
    
Vector2D AlienBullet::get_position() {
    Vector2D p = {X,Y};
    return p;    
}

void AlienBullet::set_hit(bool x) {
    Hit = x;
}

bool AlienBullet::get_hit() {
    bool x = Hit;
    return x;
}