Mochu Yao explorer game
Dependencies: mbed
Diff: explorer/explorer.h
- Revision:
- 10:559487aac60e
- Parent:
- 8:201ef0618b7d
- Child:
- 11:6740108a0825
diff -r e11bb7cef050 -r 559487aac60e explorer/explorer.h --- a/explorer/explorer.h Mon Apr 27 14:01:00 2020 +0000 +++ b/explorer/explorer.h Mon Apr 27 14:29:06 2020 +0000 @@ -6,12 +6,70 @@ * @date April 15th 2020 * @author Yaomochu */ + +/** Explorer Class +@code + #ifndef EXPLORER_H #define EXPLORER_H #include "mbed.h" #include "Gamepad.h" #include "surface.h" + +#include "mbed.h" +#include "N5110.h" +#include "Gamepad.h" +#include "explorer.h" +#include <cstdlib> +#include <ctime> + +Gamepad gamepad; +N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); +Explorer _player; + +int _player_x; +int _player_y; +bool _f_flag; +bool _r_flag; +bool _start_flag; +int _speed; +int _jump_height; +Player_direction _player_direction; +Explorer_sprite _explorer_sprite; + +int main() { + _player.init(); + _start_flag = true; + while(1) { + + // Y coordinate + if (_f_flag == true) + { + _player.fall(_f_flag, gamepad); + } else { + _player.set_y_coordinate(false, _jump_height); } + _f_flag = _player.get_fall_flag(); + _player_y = _player.get_y(); + _jump_height = _player.get_jump_height(); + + // X coordinate + _player_x = _player.get_x(); + _speed = _player.get_speed(); + _player.set_x_coordinate(1, _speed, _player_direction); + + + //change in to a new direction. + _player_direction = _player.get_direction(); + + _r_flag = _player.get_reset_flag(); + + lcd.drawSprite(_player_x,_player_y,10,10,(int *)_player.get_form(_explorer_sprite));//draw the player + } +} +@endcode +*/ + //use the enum to define the value we need for the explorer enum Explorer_sprite {Move_right,Move_left,Stand_left, Stand_right}; //we have four sprite form so we can define the sprite on the screen by using these enum