Mochu Yao explorer game
Dependencies: mbed
Diff: explorer/explorer.h
- Revision:
- 27:354d91d59b6d
- Parent:
- 26:4d193529b447
- Child:
- 30:65e639ace415
--- a/explorer/explorer.h Tue Apr 28 17:39:26 2020 +0000 +++ b/explorer/explorer.h Tue Apr 28 17:58:00 2020 +0000 @@ -18,7 +18,61 @@ * @ 3 reset the game * @ date April 15th 2020 * @ author Yaomochu -*// +* @code + +#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 +*/ class Explorer { public: