Game codes for Pokemon Academy Yiu Fai Kwok - 201198802 I have read the University Regulations on Plagiarism and state that the work covered by this declaration is my own and does not contain any unacknowledged work from other sources.
Dependencies: mbed FXOS8700CQ mbed-rtos
Diff: Game_two/Game_two.cpp
- Revision:
- 21:704d938acf5d
- Parent:
- 19:903d67bb0dea
- Child:
- 26:c60becf3f840
diff -r 50ad2dad310d -r 704d938acf5d Game_two/Game_two.cpp --- a/Game_two/Game_two.cpp Mon Apr 22 10:32:40 2019 +0000 +++ b/Game_two/Game_two.cpp Sun Apr 28 18:04:23 2019 +0000 @@ -32,6 +32,10 @@ // Game initiation _p1.init(); + _insta.init(_speed); + _twitt.init(_speed); + _face.init(_speed); + _yt.init(_speed); // Create random parameter to determine which social app should be drawn srand(time(NULL)); @@ -108,10 +112,10 @@ // see if object has hit the player by checking for overlaps if (cha == 1){ if ( - (insta_pos.y >= p1_pos.y - 8) && //top - (insta_pos.y <= p1_pos.y + 18) && //bottom - (insta_pos.x >= p1_pos.x - 6) && //left - (insta_pos.x <= p1_pos.x + 20) //right + (insta_pos.y >= p1_pos.y - 4) && //top + (insta_pos.y <= p1_pos.y + 13) && //bottom + (insta_pos.x >= p1_pos.x - 4) && //left + (insta_pos.x <= p1_pos.x + 15) //right ) { // write new attributes @@ -121,10 +125,10 @@ } if (cha == 2){ if ( - (insta_pos.y >= p1_pos.y - 8) && //top - (insta_pos.y <= p1_pos.y + 21) && //bottom - (insta_pos.x >= p1_pos.x - 6) && //left - (insta_pos.x <= p1_pos.x + 21) //right + (insta_pos.y >= p1_pos.y - 5) && //top + (insta_pos.y <= p1_pos.y + 14) && //bottom + (insta_pos.x >= p1_pos.x - 4) && //left + (insta_pos.x <= p1_pos.x + 16) //right ) { // write new attributes @@ -134,10 +138,10 @@ } if (cha == 3){ if ( - (insta_pos.y >= p1_pos.y - 8) && //top - (insta_pos.y <= p1_pos.y + 21) && //bottom - (insta_pos.x >= p1_pos.x - 6) && //left - (insta_pos.x <= p1_pos.x + 29) //right + (insta_pos.y >= p1_pos.y - 6) && //top + (insta_pos.y <= p1_pos.y + 16) && //bottom + (insta_pos.x >= p1_pos.x - 4) && //left + (insta_pos.x <= p1_pos.x + 23) //right ) { // write new attributes @@ -157,6 +161,7 @@ _count++; wait(0.1); _type = rand() % 8; // randomise type + _so = rand() % 3; } } @@ -221,6 +226,7 @@ _count++; wait(0.1); _type = rand() % 8; // randomise type + _so = rand() % 3; } } @@ -285,6 +291,7 @@ _count++; wait(0.1); _type = rand() % 8; // randomise type + _so = rand() % 3; } } @@ -349,22 +356,10 @@ _count++; wait(0.1); _type = rand() % 8; // randomise type + _so = rand() % 3; } } -/*void Game_two::check_miss_block(Gamepad &pad) -{ - Vector2D block_pos = _block.get_pos(); - // player has missed - if (block_pos.x > WIDTH) { - _block.init(_speed); - pad.tone(750.0,0.1); - wait(0.1); - _type = rand() % 8; // randomise type - } - -}*/ - void Game_two::set_count(int count) { _count = count;