Mochu Yao explorer game

Dependencies:   mbed

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?

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