Mochu Yao explorer game

Dependencies:   mbed

Committer:
el17my
Date:
Mon Apr 27 14:01:00 2020 +0000
Revision:
9:e11bb7cef050
Child:
10:559487aac60e
itemclass

Who changed what in which revision?

UserRevisionLine numberNew contents of line
el17my 9:e11bb7cef050 1 #ifndef GAMEENGINE_H
el17my 9:e11bb7cef050 2 #define GAMEENGINE_H
el17my 9:e11bb7cef050 3
el17my 9:e11bb7cef050 4 //* @the enginee file has these functions
el17my 9:e11bb7cef050 5 // 1 make the whole explorer game run and set the score the reset process
el17my 9:e11bb7cef050 6 // 2 cheak the collision and the reset or fall flag
el17my 9:e11bb7cef050 7 // 3 draw on the lcd screen and load the gamepad controll
el17my 9:e11bb7cef050 8 //* @date April 24th 2020
el17my 9:e11bb7cef050 9 //* @author Yaomochu
el17my 9:e11bb7cef050 10 #include "N5110.h"
el17my 9:e11bb7cef050 11 #include "mbed.h"
el17my 9:e11bb7cef050 12 #include "Gamepad.h"
el17my 9:e11bb7cef050 13 #include "item.h"
el17my 9:e11bb7cef050 14 #include "explorer.h"
el17my 9:e11bb7cef050 15 #include "surface.h"
el17my 9:e11bb7cef050 16 #include <cstdlib>
el17my 9:e11bb7cef050 17 #include <ctime>
el17my 9:e11bb7cef050 18
el17my 9:e11bb7cef050 19 struct Coordinate {
el17my 9:e11bb7cef050 20 Vector2D coord; /**< Vector 2D for joystick coords */
el17my 9:e11bb7cef050 21 };
el17my 9:e11bb7cef050 22
el17my 9:e11bb7cef050 23 class Gameengine {
el17my 9:e11bb7cef050 24 // Constructor and destructor.
el17my 9:e11bb7cef050 25 public:
el17my 9:e11bb7cef050 26 Gameengine();
el17my 9:e11bb7cef050 27 ~Gameengine();
el17my 9:e11bb7cef050 28 //first init all the parameter
el17my 9:e11bb7cef050 29 void init();
el17my 9:e11bb7cef050 30 void reset_game_engine();
el17my 9:e11bb7cef050 31 void read_input(Gamepad &pad);
el17my 9:e11bb7cef050 32 void check_reset(N5110 &lcd, Gamepad &gamepad);
el17my 9:e11bb7cef050 33 void check_collision(Gamepad &gamepad);
el17my 9:e11bb7cef050 34 void check_start(N5110 &lcd, Gamepad &gamepad);
el17my 9:e11bb7cef050 35 void set_fall_flag();
el17my 9:e11bb7cef050 36 bool get_start_flag();
el17my 9:e11bb7cef050 37 void generate_lines();
el17my 9:e11bb7cef050 38 int get_score();
el17my 9:e11bb7cef050 39 void get_explorer_direction();
el17my 9:e11bb7cef050 40 void get_sprite();
el17my 9:e11bb7cef050 41 void get_explorer_y(Gamepad &gamepad);
el17my 9:e11bb7cef050 42 void get_explorer_x();
el17my 9:e11bb7cef050 43 void update_lcd(N5110 &lcd);
el17my 9:e11bb7cef050 44 void run_engine(N5110 &lcd, Gamepad &gamepad);
el17my 9:e11bb7cef050 45
el17my 9:e11bb7cef050 46
el17my 9:e11bb7cef050 47 private:
el17my 9:e11bb7cef050 48 Coordinate _coordinate;
el17my 9:e11bb7cef050 49 item _item;
el17my 9:e11bb7cef050 50 Explorer _player;
el17my 9:e11bb7cef050 51 Surface _surface;
el17my 9:e11bb7cef050 52 bool X_flag;
el17my 9:e11bb7cef050 53 int _player_x;
el17my 9:e11bb7cef050 54 int _player_y;
el17my 9:e11bb7cef050 55 bool _collision_flag;
el17my 9:e11bb7cef050 56 bool _f_flag;
el17my 9:e11bb7cef050 57 bool _r_flag;
el17my 9:e11bb7cef050 58 bool _start_flag;
el17my 9:e11bb7cef050 59 int _speed;
el17my 9:e11bb7cef050 60 int _jump_height;
el17my 9:e11bb7cef050 61 int _player_score;
el17my 9:e11bb7cef050 62 Line set_line_1;
el17my 9:e11bb7cef050 63 Line set_line_2;
el17my 9:e11bb7cef050 64 Line set_line_3;
el17my 9:e11bb7cef050 65 Line line_1_value;
el17my 9:e11bb7cef050 66 Line line_2_value;
el17my 9:e11bb7cef050 67 Line line_3_value;
el17my 9:e11bb7cef050 68 Line line_4_value;
el17my 9:e11bb7cef050 69 Line line_5_value;
el17my 9:e11bb7cef050 70 Line line_6_value;
el17my 9:e11bb7cef050 71 Player_direction _player_direction;
el17my 9:e11bb7cef050 72 Explorer_sprite _explorer_sprite;
el17my 9:e11bb7cef050 73 };
el17my 9:e11bb7cef050 74 #endif
el17my 9:e11bb7cef050 75
el17my 9:e11bb7cef050 76