James Heavey
/
EL17JH
FINAL VERSION
Laser/Laser.cpp
- Committer:
- jamesheavey
- Date:
- 2019-05-06
- Revision:
- 91:c01a736fb0d9
- Parent:
- 77:d50fb95c012f
- Child:
- 93:18f81996ea89
File content as of revision 91:c01a736fb0d9:
#include "Laser.h" Laser::Laser() { } Laser::~Laser() { } void Laser::init(int x) { _x = x; _y = HEIGHT - 2; _velocity.x = 0; _velocity.y = -2; } void Laser::draw(N5110 &lcd) { if (_x >= 0) { // only draw if on screen (more efficient?) lcd.drawRect(_x,_y,2,6,FILL_BLACK); } } void Laser::update() { _x += _velocity.x; _y += _velocity.y; } int Laser::get_x() { return _x; } int Laser::get_y() { return _y; } void Laser::set_posx(int x) { _x = x; } void Laser::set_posy(int y) { _y = y; }