ZIWEI LIU
/
ELEC2645_Project_el19z2l
201377806 ZiWei Liu
Diff: DodgeEngine/DodgeEngine.cpp
- Revision:
- 10:2beb88c61882
- Parent:
- 9:50470a40d213
--- a/DodgeEngine/DodgeEngine.cpp Mon May 18 02:31:16 2020 +0000 +++ b/DodgeEngine/DodgeEngine.cpp Mon May 18 02:46:39 2020 +0000 @@ -6,12 +6,14 @@ void DodgeEngine::init(int x1up, int y1up, int x1down, int y1down, int x2up, int y2up, int x2down, int y2down, int manx, int many){ + //initiate the block and character block.blockinit(x1up, y1up, x1down, y1down, x2up, y2up,x2down,y2down); character.charinit(manx, many); } void DodgeEngine::charactermove(N5110 &lcd,Gamepad &pad){ + //control the movement and check for boundry character.move_up(pad); character.move_down(); character.boundry(); @@ -21,6 +23,7 @@ void DodgeEngine::blockmove(N5110 &lcd){ + //control the movement of the block block.draw_block(lcd); } @@ -28,17 +31,19 @@ void DodgeEngine::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){ + //check if the character has collide with the walls first check_crash(lcd,pad,x1up, y1up, x1down, y1down, x2up, y2up,x2down,y2down,manx, many); show_score(lcd); int updatescore; updatescore = block.get_score(); + //check if the player has pass the game if(updatescore > 39){ pass_game(lcd,pad); } - + //update levels by score if(updatescore > 9 && updatescore < 20){ //int test1 = 1; block.blockupgrate2(); @@ -148,7 +153,8 @@ init(x1up, y1up, x1down, y1down, x2up, y2up,x2down,y2down,manx, many); } - + +//show the score on the top left corner on the lcd screen void DodgeEngine::show_score(N5110 &lcd){ int showscore = block.get_score();