SharpShooter
Dependencies: 4DGL-uLCD-SE SDFileSystem mbed-rtos mbed wave_player
Obstacle.h
- Committer:
- SeanBuckingham
- Date:
- 2016-10-28
- Revision:
- 8:56a24df93680
- Parent:
- 5:f51cdddf541e
- Parent:
- 7:ed2c73e25681
- Child:
- 9:96a2e663994b
File content as of revision 8:56a24df93680:
class Obstacle { int x1,x2,y1,y2; uLCD_4DGL uLCD; bool direction; public: Obstacle(int x1, int x2, int y1, int y2, uLCD_4DGL uLCD); void drawObstacle(); void move(int speed); void updateLocation(); void setULCD(uLCD_4DGL uLCD); void changeDirection();// need change direction when hitting wall void setDirection(bool direction); }; Obstacle::Obstacle(int a, int b, int c, int d, uLCD_4DGL e) { x1 = a; x2 = b; y1 = c; y2 = d; this->uLCD = e; } void Obstacle::setULCD( void Obstacle::drawObstacle() { uLCD.filled_rectangle(x1,y1,x2,y2,0xFFFFFF); } void Obstacle::move(int speed) { if (direction==1) { x1 += speed; x2 += speed; } else { x1 -= speed; x2 -= speed; } } void Obstacle::changeDirection() { direction = !direction } void Obstacle::setDirection(bool a) { direction = a; }