class for obstacles in Car_race game
Diff: Obstacles.cpp
- Revision:
- 0:f8968ec0ec1b
- Child:
- 1:a735e7396af4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Obstacles.cpp Mon Mar 13 16:08:28 2017 +0000 @@ -0,0 +1,42 @@ +#include "Obstacles.h" + +Obstacles::Obstacles() +{ + +} + +Obstacles::~Obstacles() +{ + +} + +void Obstacles::init(int seed) +{ + _Obstacle_x = seed; + // try to draw them here in this function as we need the draw function for another purpose + // are we done though? we might need to split the draw function into two, one for drawing the car + // and the other for drawing the obstacles as they are drawn in a time basis +} + +void Obstacles::draw(N5110 &lcd) +{ + switch(_Obstacle_x){ + + case 0: + lcd.drawRect(2,2,24,2,1); + break; + + case 1: + lcd.drawRect(30,2,24,2,1); + break; + + case 2: + lcd.drawRect(58,2,24,2,1); + break; + } +} + +void Obstacles::update(int seed) // adjust this function to be able to store all pixels values +{ // then they are used to shift th screen + _Obstacle_x = seed; +} \ No newline at end of file