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:
Wed Jun 03 22:26:13 2020 +0000
Revision:
25:a7c89c54454a
Parent:
23:cbfa9d1ee3db
Final Submission

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 25:a7c89c54454a 9 /** TetrisGame Class
el18rs 25:a7c89c54454a 10 * @brief Runs the game
el18rs 25:a7c89c54454a 11 * @author Ruby Smith
el18rs 25:a7c89c54454a 12 * @date May 2020
el18rs 25:a7c89c54454a 13 */
el18rs 25:a7c89c54454a 14
el18rs 23:cbfa9d1ee3db 15 class TetrisGame
el18rs 3:522c6f850e91 16 {
el18rs 23:cbfa9d1ee3db 17
el18rs 23:cbfa9d1ee3db 18 public:
el18rs 25:a7c89c54454a 19 /** Constructor */
el18rs 3:522c6f850e91 20 TetrisGame();
el18rs 25:a7c89c54454a 21 /** Destructor */
el18rs 3:522c6f850e91 22 ~TetrisGame();
el18rs 23:cbfa9d1ee3db 23
el18rs 11:0183a52c1077 24 void init(int speed);
el18rs 3:522c6f850e91 25 void read_input(Gamepad &pad);
el18rs 6:39cbec524483 26 void update(Gamepad &pad, N5110 &lcd);
el18rs 3:522c6f850e91 27 void draw(N5110 &lcd);
el18rs 15:68114eae4053 28 void fallenblocks(N5110 &lcd, int iH);
el18rs 22:403759d2f093 29 void clearline(N5110 &lcd, int iB);
el18rs 23:cbfa9d1ee3db 30 void print_scores(N5110 &lcd);
el18rs 23:cbfa9d1ee3db 31 void check_score(Gamepad &pad);
el18rs 23:cbfa9d1ee3db 32 void currentscreen(N5110 &lcd);
el18rs 23:cbfa9d1ee3db 33
el18rs 15:68114eae4053 34 // private:
el18rs 23:cbfa9d1ee3db 35
el18rs 6:39cbec524483 36 void check_wall_collision(Gamepad &pad, N5110 &lcd);
el18rs 6:39cbec524483 37 void check_tetromino_collisions(Gamepad &pad, N5110 &lcd);
el18rs 23:cbfa9d1ee3db 38
el18rs 6:39cbec524483 39 void cancel_line(N5110 &lcd);
el18rs 6:39cbec524483 40 void exit_game(N5110 &lcd);
el18rs 23:cbfa9d1ee3db 41
el18rs 6:39cbec524483 42 // Tetromino _p1;
el18rs 23:cbfa9d1ee3db 43
el18rs 22:403759d2f093 44 int count;
el18rs 15:68114eae4053 45 volatile int X[50];
el18rs 15:68114eae4053 46 volatile int Y[50];
el18rs 22:403759d2f093 47 volatile int Z[50];
el18rs 23:cbfa9d1ee3db 48 volatile int Q[50];
el18rs 15:68114eae4053 49 volatile int floor_hit_flag;
el18rs 22:403759d2f093 50 volatile int clear_line_flag;
el18rs 15:68114eae4053 51 volatile int a;
el18rs 15:68114eae4053 52 volatile int b;
el18rs 22:403759d2f093 53 volatile int c;
el18rs 23:cbfa9d1ee3db 54 volatile int d;
el18rs 11:0183a52c1077 55 int _px;
el18rs 11:0183a52c1077 56 int _py;
el18rs 15:68114eae4053 57 int x0;
el18rs 15:68114eae4053 58 int y0;
el18rs 22:403759d2f093 59 int z0;
el18rs 23:cbfa9d1ee3db 60 int q0;
el18rs 3:522c6f850e91 61 int _speed;
el18rs 25:a7c89c54454a 62 int score;
el18rs 23:cbfa9d1ee3db 63 int buffer[84][48];
el18rs 25:a7c89c54454a 64 char Sbuffer[14];
el18rs 23:cbfa9d1ee3db 65
el18rs 3:522c6f850e91 66 Tetromino _tetromino;
el18rs 23:cbfa9d1ee3db 67
el18rs 3:522c6f850e91 68 Direction _d;
el18rs 3:522c6f850e91 69 float _mag;
el18rs 3:522c6f850e91 70 };
el18rs 3:522c6f850e91 71
el18rs 3:522c6f850e91 72 #endif