Mochu Yao explorer game
Dependencies: mbed
Gameengine/Gameengine.h@26:4d193529b447, 2020-04-28 (annotated)
- Committer:
- el17my
- Date:
- Tue Apr 28 17:39:26 2020 +0000
- Revision:
- 26:4d193529b447
- Parent:
- 23:7be9701fc1b8
- Child:
- 27:354d91d59b6d
4.29
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el17my | 9:e11bb7cef050 | 1 | #ifndef GAMEENGINE_H |
el17my | 9:e11bb7cef050 | 2 | #define GAMEENGINE_H |
el17my | 9:e11bb7cef050 | 3 | |
el17my | 14:5e73a6e34c17 | 4 | |
el17my | 14:5e73a6e34c17 | 5 | #include "N5110.h" |
el17my | 14:5e73a6e34c17 | 6 | #include "mbed.h" |
el17my | 14:5e73a6e34c17 | 7 | #include "Gamepad.h" |
el17my | 14:5e73a6e34c17 | 8 | #include "item.h" |
el17my | 14:5e73a6e34c17 | 9 | #include "explorer.h" |
el17my | 14:5e73a6e34c17 | 10 | #include "surface.h" |
el17my | 14:5e73a6e34c17 | 11 | #include <cstdlib> |
el17my | 14:5e73a6e34c17 | 12 | #include <ctime> |
el17my | 14:5e73a6e34c17 | 13 | |
el17my | 14:5e73a6e34c17 | 14 | struct Coordinate { |
el17my | 14:5e73a6e34c17 | 15 | Vector2D coord; /**< Vector 2D for joystick coords */ |
el17my | 14:5e73a6e34c17 | 16 | }; |
el17my | 10:559487aac60e | 17 | |
el17my | 9:e11bb7cef050 | 18 | class Gameengine { |
el17my | 9:e11bb7cef050 | 19 | // Constructor and destructor. |
el17my | 9:e11bb7cef050 | 20 | public: |
el17my | 9:e11bb7cef050 | 21 | Gameengine(); |
el17my | 9:e11bb7cef050 | 22 | ~Gameengine(); |
el17my | 9:e11bb7cef050 | 23 | //first init all the parameter |
el17my | 9:e11bb7cef050 | 24 | void init(); |
el17my | 9:e11bb7cef050 | 25 | void reset_game_engine(); |
el17my | 9:e11bb7cef050 | 26 | void read_input(Gamepad &pad); |
el17my | 9:e11bb7cef050 | 27 | void check_reset(N5110 &lcd, Gamepad &gamepad); |
el17my | 9:e11bb7cef050 | 28 | void check_collision(Gamepad &gamepad); |
el17my | 9:e11bb7cef050 | 29 | void check_start(N5110 &lcd, Gamepad &gamepad); |
el17my | 9:e11bb7cef050 | 30 | void set_fall_flag(); |
el17my | 9:e11bb7cef050 | 31 | bool get_start_flag(); |
el17my | 9:e11bb7cef050 | 32 | void generate_lines(); |
el17my | 9:e11bb7cef050 | 33 | int get_score(); |
el17my | 9:e11bb7cef050 | 34 | void get_explorer_direction(); |
el17my | 9:e11bb7cef050 | 35 | void get_sprite(); |
el17my | 9:e11bb7cef050 | 36 | void get_explorer_y(Gamepad &gamepad); |
el17my | 9:e11bb7cef050 | 37 | void get_explorer_x(); |
el17my | 9:e11bb7cef050 | 38 | void update_lcd(N5110 &lcd); |
el17my | 9:e11bb7cef050 | 39 | void run_engine(N5110 &lcd, Gamepad &gamepad); |
el17my | 9:e11bb7cef050 | 40 | |
el17my | 9:e11bb7cef050 | 41 | |
el17my | 9:e11bb7cef050 | 42 | private: |
el17my | 9:e11bb7cef050 | 43 | Coordinate _coordinate; |
el17my | 9:e11bb7cef050 | 44 | item _item; |
el17my | 9:e11bb7cef050 | 45 | Explorer _player; |
el17my | 9:e11bb7cef050 | 46 | Surface _surface; |
el17my | 23:7be9701fc1b8 | 47 | bool X_flag; |
el17my | 23:7be9701fc1b8 | 48 | int _player_x; |
el17my | 23:7be9701fc1b8 | 49 | int _player_y; |
el17my | 23:7be9701fc1b8 | 50 | bool _collision_flag; |
el17my | 23:7be9701fc1b8 | 51 | bool _f_flag; |
el17my | 23:7be9701fc1b8 | 52 | bool _r_flag; |
el17my | 23:7be9701fc1b8 | 53 | bool _start_flag; |
el17my | 23:7be9701fc1b8 | 54 | int _speed; |
el17my | 23:7be9701fc1b8 | 55 | int _jump_height; |
el17my | 23:7be9701fc1b8 | 56 | int _player_score; |
el17my | 9:e11bb7cef050 | 57 | Line set_line_1; |
el17my | 9:e11bb7cef050 | 58 | Line set_line_2; |
el17my | 9:e11bb7cef050 | 59 | Line set_line_3; |
el17my | 9:e11bb7cef050 | 60 | Line line_1_value; |
el17my | 9:e11bb7cef050 | 61 | Line line_2_value; |
el17my | 9:e11bb7cef050 | 62 | Line line_3_value; |
el17my | 9:e11bb7cef050 | 63 | Line line_4_value; |
el17my | 9:e11bb7cef050 | 64 | Line line_5_value; |
el17my | 9:e11bb7cef050 | 65 | Line line_6_value; |
el17my | 9:e11bb7cef050 | 66 | Player_direction _player_direction; |
el17my | 9:e11bb7cef050 | 67 | Explorer_sprite _explorer_sprite; |
el17my | 9:e11bb7cef050 | 68 | }; |
el17my | 9:e11bb7cef050 | 69 | #endif |
el17my | 9:e11bb7cef050 | 70 | |
el17my | 9:e11bb7cef050 | 71 |