Nemesis game, sixth enemy

Committer:
musallambseiso
Date:
Tue May 02 22:14:07 2017 +0000
Revision:
3:4cd823c51ce0
Child:
4:3ee9dc3f28fc
Added Doxygen, tidied code

Who changed what in which revision?

UserRevisionLine numberNew contents of line
musallambseiso 3:4cd823c51ce0 1 #include "Enemy6.h"
musallambseiso 3:4cd823c51ce0 2
musallambseiso 3:4cd823c51ce0 3 Enemy6::Enemy6()
musallambseiso 3:4cd823c51ce0 4 {
musallambseiso 3:4cd823c51ce0 5
musallambseiso 3:4cd823c51ce0 6 }
musallambseiso 3:4cd823c51ce0 7
musallambseiso 3:4cd823c51ce0 8 Enemy6::~Enemy6()
musallambseiso 3:4cd823c51ce0 9 {
musallambseiso 3:4cd823c51ce0 10
musallambseiso 3:4cd823c51ce0 11 }
musallambseiso 3:4cd823c51ce0 12
musallambseiso 3:4cd823c51ce0 13 void Enemy6::init(int speed)
musallambseiso 3:4cd823c51ce0 14 {
musallambseiso 3:4cd823c51ce0 15 int x = rand() % 63 + 84;
musallambseiso 3:4cd823c51ce0 16 _x = x;
musallambseiso 3:4cd823c51ce0 17 _y = 33;
musallambseiso 3:4cd823c51ce0 18
musallambseiso 3:4cd823c51ce0 19 _velocity.x = -speed;
musallambseiso 3:4cd823c51ce0 20 _velocity.y = 0;
musallambseiso 3:4cd823c51ce0 21 }
musallambseiso 3:4cd823c51ce0 22
musallambseiso 3:4cd823c51ce0 23 void Enemy6::draw(N5110 &lcd)
musallambseiso 3:4cd823c51ce0 24 {
musallambseiso 3:4cd823c51ce0 25 lcd.drawLine(_x,_y,_x,_y+5,1);
musallambseiso 3:4cd823c51ce0 26 lcd.drawLine(_x-1,_y,_x-1,_y+5,1);
musallambseiso 3:4cd823c51ce0 27 lcd.drawLine(_x-2,_y+1,_x-2,_y+4,1);
musallambseiso 3:4cd823c51ce0 28 lcd.drawLine(_x-3,_y+1,_x-3,_y+4,1);
musallambseiso 3:4cd823c51ce0 29 lcd.drawLine(_x-4,_y+2,_x-4,_y+3,1);
musallambseiso 3:4cd823c51ce0 30 }
musallambseiso 3:4cd823c51ce0 31
musallambseiso 3:4cd823c51ce0 32 void Enemy6::update()
musallambseiso 3:4cd823c51ce0 33 {
musallambseiso 3:4cd823c51ce0 34 _x += _velocity.x;
musallambseiso 3:4cd823c51ce0 35 _y += _velocity.y;
musallambseiso 3:4cd823c51ce0 36 }
musallambseiso 3:4cd823c51ce0 37
musallambseiso 3:4cd823c51ce0 38 Vector2D Enemy6::get_pos()
musallambseiso 3:4cd823c51ce0 39 {
musallambseiso 3:4cd823c51ce0 40 Vector2D p = {_x,_y};
musallambseiso 3:4cd823c51ce0 41 return p;
musallambseiso 3:4cd823c51ce0 42 }