One class remains, but it is the most important. All parts of the game are ready, but you’ll have to bring them together to construct the actual game. This is the purpose of the class gameLogic. Its framework looks like this:
class gameLogic
{
private:
// blocks in the game
5 block currentBlock;
block nextBlock ;
float forceDownCounter = 0 ;
float slideCounter = SLIDE_TIME;
10
// to move a block completely down
bool toBottom = false;
float toBottomTimer = 0.05 ;
15 bool canRotate (C block & b ) C {}
bool canMove (C block & b, DIRECTION dir) C {}
void handleBottomCollision() {}
void changeFocusBlock () {}
void checkLoss () C {}
20 void handleInput () {}
public:
void create()
void update() {}
25 void draw () C {}
}
gameLogic GameLogic;
Let’s look at the variables first: