
Joshua O'hara 201291390
Dependencies: mbed
Diff: Ship/Ship.cpp
- Revision:
- 8:86cb9a9f8a73
- Parent:
- 7:06a2558155f0
- Child:
- 9:8e695df3cc36
--- a/Ship/Ship.cpp Tue Mar 24 16:44:48 2020 +0000 +++ b/Ship/Ship.cpp Thu Mar 26 15:24:49 2020 +0000 @@ -1,16 +1,39 @@ #include "Ship.h" +N5110 lcdShip; + +Ship::Ship() +{ + +} + +Ship::~Ship() +{ + +} + void Ship::init(int height, int width) { X = WIDTH/2 - width/2; - Y = HEIGHT - Height; + Y = HEIGHT - 2; Height = height; Width = width; Speed = 0; + +//lcdShip.printString("ShipInit",0,1); +//lcdShip.refresh(); +//wait(2); +//char buffer[14]; +//sprintf(buffer,"X = %2d ",X); +//lcdShip.printString(buffer,0,5); +//lcdShip.refresh(); +wait(2); + } -void Ship::draw(N5110 &lcd) -{ + +void Ship::render(N5110 &lcd) +{ lcd.drawRect(X,Y,Width,Height,FILL_BLACK); } @@ -35,9 +58,19 @@ if (X < 1) { X = 1; } - if (X > HEIGHT - Height - 1) { - X = HEIGHT - Height - 1; + if (X > WIDTH - Width - 1) { + X = WIDTH - Width - 1; } + +//char buffer[14]; +//sprintf(buffer,"X = %2d ",X); +//lcdShip.printString(buffer,0,5); +//lcdShip.refresh(); +//wait(2); + +//lcdShip.printString("ShipUpdate",0,1); +//lcdShip.refresh(); +//wait(5); } Vector2D Ship::get_position() { @@ -55,9 +88,6 @@ return width; } -//void Ship::set_life(bool l) { - // Life = l; -//} \ No newline at end of file