Mochu Yao explorer game

Dependencies:   mbed

Committer:
el17my
Date:
Thu Apr 23 07:49:39 2020 +0000
Revision:
7:88c4ba6bb37b
Parent:
4:64746224ab6e
Child:
8:201ef0618b7d
start to creat game enginee

Who changed what in which revision?

UserRevisionLine numberNew contents of line
el17my 7:88c4ba6bb37b 1 /** explorer
el17my 7:88c4ba6bb37b 2 * @the explorer file has three functions
el17my 7:88c4ba6bb37b 3 1 the movement of a explorer to jump and move in left or right direction
el17my 7:88c4ba6bb37b 4 2 check fallen and collision
el17my 7:88c4ba6bb37b 5 3 reset the game
el17my 7:88c4ba6bb37b 6 * @date April 15th 2020
el17my 7:88c4ba6bb37b 7 * @author Yaomochu
el17my 7:88c4ba6bb37b 8 */
el17my 7:88c4ba6bb37b 9 #ifndef EXPLORER_H
el17my 7:88c4ba6bb37b 10 #define EXPLORER_H
el17my 7:88c4ba6bb37b 11
el17my 7:88c4ba6bb37b 12 #include "mbed.h"
el17my 7:88c4ba6bb37b 13 #include "Gamepad.h"
el17my 7:88c4ba6bb37b 14 //use the enum to define the value we need for the explorer
el17my 7:88c4ba6bb37b 15 enum explorer_sprite{Move_right,Move_left,Stand_left, Stand_right};
el17my 7:88c4ba6bb37b 16 //we have four sprite form so we can define the sprite on the screen by using these enum
el17my 7:88c4ba6bb37b 17 //the explorer's direction
el17my 7:88c4ba6bb37b 18 enum Player_direction {right,left};
el17my 7:88c4ba6bb37b 19
el17my 7:88c4ba6bb37b 20 class Explorer {
el17my 7:88c4ba6bb37b 21 public:
el17my 7:88c4ba6bb37b 22 Explorer();
el17my 7:88c4ba6bb37b 23 //Constructor
el17my 7:88c4ba6bb37b 24 ~Explorer();
el17my 7:88c4ba6bb37b 25 //Destructor
el17my 7:88c4ba6bb37b 26 void set_x_coordinate(float joy_x, int speed, Player_direction direction);
el17my 7:88c4ba6bb37b 27 void set_y_coordinate(bool ifjump, int jump_height, int level);
el17my 7:88c4ba6bb37b 28 int get_y();
el17my 7:88c4ba6bb37b 29
el17my 7:88c4ba6bb37b 30 int get_x();
el17my 7:88c4ba6bb37b 31
el17my 7:88c4ba6bb37b 32 int get_speed();
el17my 7:88c4ba6bb37b 33
el17my 7:88c4ba6bb37b 34 int get_jump_height();
el17my 7:88c4ba6bb37b 35
el17my 7:88c4ba6bb37b 36 Player_direction get_direction();
el17my 7:88c4ba6bb37b 37
el17my 7:88c4ba6bb37b 38 explorer_sprite get_explorer_sprite();
el17my 7:88c4ba6bb37b 39
el17my 7:88c4ba6bb37b 40 int * get_form(explorer_sprite sprite);
el17my 7:88c4ba6bb37b 41 //this function is used to get the players form and print on the screen (same as the item file)
el17my 7:88c4ba6bb37b 42
el17my 7:88c4ba6bb37b 43 void fall(bool f_flag, Gamepad &gamepad);
el17my 7:88c4ba6bb37b 44 //the fall flag need to add music to hint the player that the game is over
el17my 7:88c4ba6bb37b 45 void reset_flag(bool reset_flag,Gamepad &gamepad);
el17my 7:88c4ba6bb37b 46 //the reset flag also need to add music to hint the player that the game has been reseted
el17my 7:88c4ba6bb37b 47 bool get_fall_flag();
el17my 7:88c4ba6bb37b 48
el17my 7:88c4ba6bb37b 49 bool get_reset_flag();
el17my 7:88c4ba6bb37b 50
el17my 7:88c4ba6bb37b 51 private:
el17my 7:88c4ba6bb37b 52
el17my 7:88c4ba6bb37b 53 int _x;
el17my 7:88c4ba6bb37b 54 int _y;
el17my 7:88c4ba6bb37b 55 int _speed;
el17my 7:88c4ba6bb37b 56 int _level;
el17my 7:88c4ba6bb37b 57 int _jump_height;
el17my 7:88c4ba6bb37b 58 bool _f_flag;
el17my 7:88c4ba6bb37b 59 bool _r_flag;
el17my 7:88c4ba6bb37b 60 Player_direction _player_direction;
el17my 7:88c4ba6bb37b 61 explorer_sprite _explorer_sprite;
el17my 7:88c4ba6bb37b 62 };
el17my 7:88c4ba6bb37b 63 #endif