Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Bullets/Bullets.cpp
- Committer:
- Albutt
- Date:
- 2020-05-23
- Revision:
- 9:62fe47a1374f
- Parent:
- 8:0c6d6ed55851
- Child:
- 12:c557b6c9b17a
File content as of revision 9:62fe47a1374f:
#include "Bullets.h" Serial pcb(USBTX, USBRX); Bullets::Bullets(int ex, int wy, Direction d) { _dir = 0; _x = ex; _y = wy; if (d == N) { _dir = 0; } else if (d == E) { _dir = 1; } else if (d == S) { _dir = 2; } else if (d == W) { _dir = 3; } //pcb.printf("Direction = %d", _dir); } Bullets::~Bullets() { } void Bullets::draw(N5110 &lcd) { lcd.drawRect(_x,_y,1,1,FILL_BLACK); } void Bullets::update() { if(_dir == 0){ _y = _y-3; } else if (_dir == 1){ _x = _x+3; } else if (_dir == 2){ _y = _y+3; } else if (_dir == 3){ _x = _x-3; } } int Bullets::get_x(){ return _x; } int Bullets::get_y(){ return _y; } void Bullets::dead(){ _x = 2147483647; _y = 1000; }