All there but errors need fixing

Dependencies:   mbed

Overview:

Rookie Tetris is a jigsaw style game based on the classic Tetris.

A block will appear at the top of the screen, you must move it (your options for movement are left, right and down - you cannot move up the board). The block will stop when it if placed either on the floor of the board or on-top of another block.

Your goal is to fill a complete row of the board with the blocks; when you do so the row will delete and the pattern above it will drop down. The game is over when your pattern is tall enough to reach to the top of the board!

Controls:

Use the joystick to move your block! Your block cannot move out of the parameters of the board.

Pot 2 controls the contrast of the screen.

Committer:
el18rs
Date:
Sun May 24 11:18:33 2020 +0000
Revision:
3:522c6f850e91
Child:
4:7ddd287a5d28
Game engine added

Who changed what in which revision?

UserRevisionLine numberNew contents of line
el18rs 3:522c6f850e91 1 #ifndef TETRISGAME_H
el18rs 3:522c6f850e91 2 #define TETRISGAME_H
el18rs 3:522c6f850e91 3
el18rs 3:522c6f850e91 4 #include "mbed.h"
el18rs 3:522c6f850e91 5 #include "N5110.h"
el18rs 3:522c6f850e91 6 #include "Gamepad.h"
el18rs 3:522c6f850e91 7 #include "Tetromino.h"
el18rs 3:522c6f850e91 8
el18rs 3:522c6f850e91 9 #define GAP 0
el18rs 3:522c6f850e91 10
el18rs 3:522c6f850e91 11 class TetrisGame
el18rs 3:522c6f850e91 12 {
el18rs 3:522c6f850e91 13
el18rs 3:522c6f850e91 14 public:
el18rs 3:522c6f850e91 15 TetrisGame();
el18rs 3:522c6f850e91 16 ~TetrisGame();
el18rs 3:522c6f850e91 17
el18rs 3:522c6f850e91 18 void init(int tetromino_width, int tetromino_height, int tetromino_size, int speed);
el18rs 3:522c6f850e91 19 void read_input(Gamepad &pad);
el18rs 3:522c6f850e91 20 void update(Gamepad &pad);
el18rs 3:522c6f850e91 21 void draw(N5110 &lcd);
el18rs 3:522c6f850e91 22
el18rs 3:522c6f850e91 23 private:
el18rs 3:522c6f850e91 24
el18rs 3:522c6f850e91 25 void check_wall_collision(Gamepad &pad);
el18rs 3:522c6f850e91 26 void check_tetromino_collision(Gamepad &pad);
el18rs 3:522c6f850e91 27 void check_goal(Gamepad &pad);
el18rs 3:522c6f850e91 28
el18rs 3:522c6f850e91 29 Tetromino _p1;
el18rs 3:522c6f850e91 30
el18rs 3:522c6f850e91 31 int _tetromino_width;
el18rs 3:522c6f850e91 32 int _tetromino_height;
el18rs 3:522c6f850e91 33 int _tetromino_size;
el18rs 3:522c6f850e91 34 int _speed;
el18rs 3:522c6f850e91 35
el18rs 3:522c6f850e91 36 int _p1x;
el18rs 3:522c6f850e91 37
el18rs 3:522c6f850e91 38 Tetromino _tetromino;
el18rs 3:522c6f850e91 39
el18rs 3:522c6f850e91 40 Direction _d;
el18rs 3:522c6f850e91 41 float _mag;
el18rs 3:522c6f850e91 42
el18rs 3:522c6f850e91 43 };
el18rs 3:522c6f850e91 44
el18rs 3:522c6f850e91 45 #endif