Nemesis game, sixth enemy

Enemy6.cpp

Committer:
musallambseiso
Date:
2017-05-02
Revision:
3:4cd823c51ce0
Child:
4:3ee9dc3f28fc

File content as of revision 3:4cd823c51ce0:

#include "Enemy6.h"

Enemy6::Enemy6()
{

}

Enemy6::~Enemy6()
{

}

void Enemy6::init(int speed)
{   
    int x = rand() % 63 + 84;
    _x = x;
    _y = 33;

    _velocity.x = -speed;
    _velocity.y = 0;
}

void Enemy6::draw(N5110 &lcd)
{
    lcd.drawLine(_x,_y,_x,_y+5,1);
    lcd.drawLine(_x-1,_y,_x-1,_y+5,1);
    lcd.drawLine(_x-2,_y+1,_x-2,_y+4,1);
    lcd.drawLine(_x-3,_y+1,_x-3,_y+4,1);
    lcd.drawLine(_x-4,_y+2,_x-4,_y+3,1);
}

void Enemy6::update()
{
    _x += _velocity.x;
    _y += _velocity.y;
}

Vector2D Enemy6::get_pos()
{
    Vector2D p = {_x,_y};
    return p;
}