![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
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.
TetrisGame/TetrisGame.h@14:bd8c59a4b641, 2020-06-02 (annotated)
- Committer:
- el18rs
- Date:
- Tue Jun 02 18:38:09 2020 +0000
- Revision:
- 14:bd8c59a4b641
- Parent:
- 13:600a34a047ca
- Child:
- 15:68114eae4053
compiles
Who changed what in which revision?
User | Revision | Line number | New 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 | class TetrisGame |
el18rs | 3:522c6f850e91 | 10 | { |
el18rs | 3:522c6f850e91 | 11 | |
el18rs | 3:522c6f850e91 | 12 | public: |
el18rs | 3:522c6f850e91 | 13 | TetrisGame(); |
el18rs | 3:522c6f850e91 | 14 | ~TetrisGame(); |
el18rs | 3:522c6f850e91 | 15 | |
el18rs | 11:0183a52c1077 | 16 | void init(int speed); |
el18rs | 3:522c6f850e91 | 17 | void read_input(Gamepad &pad); |
el18rs | 6:39cbec524483 | 18 | void update(Gamepad &pad, N5110 &lcd); |
el18rs | 3:522c6f850e91 | 19 | void draw(N5110 &lcd); |
el18rs | 4:7ddd287a5d28 | 20 | //void play_game(); |
el18rs | 3:522c6f850e91 | 21 | |
el18rs | 14:bd8c59a4b641 | 22 | // volatile int X[50]; |
el18rs | 14:bd8c59a4b641 | 23 | // volatile int Y[50]; |
el18rs | 14:bd8c59a4b641 | 24 | volatile int floor_hit_flag; |
el18rs | 14:bd8c59a4b641 | 25 | volatile int a; |
el18rs | 14:bd8c59a4b641 | 26 | volatile int b; |
el18rs | 14:bd8c59a4b641 | 27 | private: |
el18rs | 3:522c6f850e91 | 28 | |
el18rs | 6:39cbec524483 | 29 | void check_wall_collision(Gamepad &pad, N5110 &lcd); |
el18rs | 6:39cbec524483 | 30 | void check_tetromino_collisions(Gamepad &pad, N5110 &lcd); |
el18rs | 4:7ddd287a5d28 | 31 | // void check_score(Gamepad &pad); |
el18rs | 4:7ddd287a5d28 | 32 | |
el18rs | 6:39cbec524483 | 33 | void cancel_line(N5110 &lcd); |
el18rs | 6:39cbec524483 | 34 | void exit_game(N5110 &lcd); |
el18rs | 3:522c6f850e91 | 35 | |
el18rs | 6:39cbec524483 | 36 | // Tetromino _p1; |
el18rs | 3:522c6f850e91 | 37 | |
el18rs | 14:bd8c59a4b641 | 38 | |
el18rs | 11:0183a52c1077 | 39 | int _px; |
el18rs | 11:0183a52c1077 | 40 | int _py; |
el18rs | 11:0183a52c1077 | 41 | // int _tetromino_height; |
el18rs | 11:0183a52c1077 | 42 | // int _tetromino_width; |
el18rs | 3:522c6f850e91 | 43 | int _speed; |
el18rs | 14:bd8c59a4b641 | 44 | volatile int iH; |
el18rs | 3:522c6f850e91 | 45 | |
el18rs | 3:522c6f850e91 | 46 | Tetromino _tetromino; |
el18rs | 3:522c6f850e91 | 47 | |
el18rs | 3:522c6f850e91 | 48 | Direction _d; |
el18rs | 3:522c6f850e91 | 49 | float _mag; |
el18rs | 3:522c6f850e91 | 50 | }; |
el18rs | 3:522c6f850e91 | 51 | |
el18rs | 3:522c6f850e91 | 52 | #endif |