Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
DodgeEngine.h
00001 #ifndef DODGEENGINE_H 00002 #define DODGEENGINE_H 00003 00004 #include "mbed.h" 00005 #include "N5110.h" 00006 #include "Gamepad.h" 00007 #include "Character.h" 00008 #include "Block.h" 00009 00010 /** DodgeEngine class 00011 * @the engine of the whole game 00012 * @author ZiWei Liu Alex 00013 * @date May,2020 00014 */ 00015 00016 00017 class DodgeEngine{ 00018 00019 public: 00020 /**Constructor*/ 00021 DodgeEngine(); 00022 /**Destructor*/ 00023 ~DodgeEngine(); 00024 00025 /** control the movement of character and the boundry of the character 00026 * @param lcd and gamepad 00027 */ 00028 void charactermove(N5110 &lcd,Gamepad &pad); 00029 00030 /** control the movement of blockmove 00031 * @param lcd 00032 */ 00033 void blockmove(N5110 &lcd); 00034 00035 /** update the wall's movement and the score 00036 *@param lcd, gamepad and the coordinates of walls, character 00037 */ 00038 void dodgeupdate(N5110 &lcd,Gamepad &pad,int x1up, int y1up, int x1down, int y1down, int x2up, int y2up, int x2down, int y2down, int manx, int many); 00039 00040 /** initate the character and wall 00041 * @param the coordinates of walls, character 00042 */ 00043 void init(int x1up, int y1up, int x1down, int y1down, int x2up, int y2up, int x2down, int y2down, int manx, int many); 00044 00045 /** check if the character has collide with the wall 00046 * @param lcd,gamepad and the coordinates of the character,walls 00047 */ 00048 void check_crash(N5110 &lcd, Gamepad &pad,int x1up, int y1up, int x1down, int y1down, int x2up, int y2up, int x2down, int y2down, int manx, int many); 00049 00050 /** print the score on the top left corner 00051 * @param lcd, gamepad and the coordinates of the character, walls 00052 */ 00053 void print_score(N5110 &lcd, Gamepad &pad,int x1up, int y1up, int x1down, int y1down, int x2up, int y2up, int x2down, int y2down, int manx, int many); 00054 00055 /** show the score when game is over(failed) 00056 * @param lcd 00057 */ 00058 void show_score(N5110 &lcd); 00059 00060 /** show the score when game is over(passed) 00061 * @param lcd 00062 */ 00063 void pass_game(N5110 &lcd, Gamepad &pad); 00064 00065 private: 00066 Character character; 00067 Block block; 00068 00069 00070 }; 00071 00072 #endif
Generated on Sat Jul 16 2022 00:49:04 by
