Tarek Bessalah 201344887

Dependencies:   mbed

Objective The objective of the game is to reach the end goals located at the top of the screen, as well as avoiding the snakes, vehicles, turtles when they are underground, and the water. As the levels progress, things get harder! So You need to avoid enemy objects. Make sure to get on logs when you want to cross the water.

Intro Screen

Play - You need to pass Level 1 in order to progress to the following level Tutorial- This informs you how to play the game Bonus - This is a bonus level, this is a very challenging so play with precautions! You cannot hit the objects, and go into the void background frogger_logo_owner.png 404 x 152 px 14.0 KB May 27, 2020 1 Item Image: 1 Document: 0

To control the menu use the X button to go up, and the B button to go down. Use A to select. To skip through the tutorial pages, use A. At the endhttps://os.mbed.com/media/uploads/el19tb/frogger_logo_owner.png of the tutorial you will play the game.

Controls

Use A, X, B, Y to move right, Up, Down, and Left respectively, this controls the frog object

Committer:
el19tb
Date:
Wed May 27 01:54:46 2020 +0000
Revision:
61:3714af9caab6
Parent:
55:b17b9931c010
Final Submission. I have read and agreed with Statement of Academic Integrity.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
el19tb 55:b17b9931c010 1 #include "Test.h"
el19tb 55:b17b9931c010 2
el19tb 55:b17b9931c010 3 /** TEST FROG CLASS */
el19tb 55:b17b9931c010 4
el19tb 55:b17b9931c010 5 /** Function that checks whether Frog has respawned in the right
el19tb 55:b17b9931c010 6 * position
el19tb 55:b17b9931c010 7 */
el19tb 55:b17b9931c010 8 bool test_frog_reset(float expect_value_x, float expec_value_y)
el19tb 55:b17b9931c010 9 {
el19tb 55:b17b9931c010 10 Frog test_frog((84/2)-6/2, 48-4, 6); // test a frog object
el19tb 55:b17b9931c010 11 //printf("Frog reset x pos: %d,%d", x, y);
el19tb 55:b17b9931c010 12 if(test_frog.x == expect_value_x && test_frog.y == expec_value_y){
el19tb 55:b17b9931c010 13 //printf("FROG TEST PASSED");
el19tb 55:b17b9931c010 14 return true;
el19tb 55:b17b9931c010 15 } else {
el19tb 55:b17b9931c010 16 //printf("FROG TEST FAILED, %d", test_frog.x);
el19tb 55:b17b9931c010 17 return false;
el19tb 55:b17b9931c010 18 }
el19tb 55:b17b9931c010 19 }
el19tb 55:b17b9931c010 20
el19tb 55:b17b9931c010 21 void run_frog_test()
el19tb 55:b17b9931c010 22 {
el19tb 55:b17b9931c010 23 test_frog_reset((84/2)-6/2, 48-4);
el19tb 55:b17b9931c010 24 test_frog_reset((64/2)-6/2, 24-4);
el19tb 55:b17b9931c010 25 test_frog_reset((32/2)-6/2, 12-4);
el19tb 55:b17b9931c010 26 }
el19tb 55:b17b9931c010 27
el19tb 55:b17b9931c010 28 /** TEST OBJECT CLASS */
el19tb 55:b17b9931c010 29
el19tb 55:b17b9931c010 30 /** Returns true if the input row will give the correct y pos */
el19tb 55:b17b9931c010 31 bool test_row_func(int row, int object_y_coord)
el19tb 55:b17b9931c010 32 {
el19tb 55:b17b9931c010 33 Object test_object;
el19tb 55:b17b9931c010 34 printf("Object row test: %d", row);
el19tb 55:b17b9931c010 35 if(test_object.object.y == object_y_coord){
el19tb 55:b17b9931c010 36 // printf("OBJECT TEST PASSED");
el19tb 55:b17b9931c010 37 return true;
el19tb 55:b17b9931c010 38 } else {
el19tb 55:b17b9931c010 39 // printf("OBJECT TEST FAILED, %d", row);
el19tb 55:b17b9931c010 40 return false;
el19tb 55:b17b9931c010 41 }
el19tb 55:b17b9931c010 42 }
el19tb 55:b17b9931c010 43
el19tb 55:b17b9931c010 44 /** function tests that the object class creates the rectangle correcly */
el19tb 55:b17b9931c010 45 bool test_rec_paramaters(int x, int y, char c)
el19tb 55:b17b9931c010 46 {
el19tb 55:b17b9931c010 47 Object test_object;
el19tb 55:b17b9931c010 48 if(test_object.rectangle.right_side == (x + test_object.width) &&
el19tb 55:b17b9931c010 49 test_object.rectangle.bottom == y + test_object.height
el19tb 55:b17b9931c010 50 && test_object.rectangle.up == test_object.object.y){
el19tb 55:b17b9931c010 51 //printf("OBJECT TEST PASSED");
el19tb 55:b17b9931c010 52 return true;
el19tb 55:b17b9931c010 53 } else {
el19tb 55:b17b9931c010 54 //printf("OBJECT TEST FAILED, %d, %d, object type: ", x, y, c);
el19tb 55:b17b9931c010 55 return false;
el19tb 55:b17b9931c010 56 }
el19tb 55:b17b9931c010 57 }
el19tb 55:b17b9931c010 58
el19tb 55:b17b9931c010 59 bool test_speed_funcs(int dir)
el19tb 55:b17b9931c010 60 {
el19tb 55:b17b9931c010 61 Object test_object;
el19tb 55:b17b9931c010 62 if(test_object.object.dir == dir){
el19tb 55:b17b9931c010 63 //printf("OBJECT TEST PASSED");
el19tb 55:b17b9931c010 64 return true;
el19tb 55:b17b9931c010 65 } else {
el19tb 55:b17b9931c010 66 //printf("OBJECT TEST FAILED, %d", dir);
el19tb 55:b17b9931c010 67 return false;
el19tb 55:b17b9931c010 68 }
el19tb 55:b17b9931c010 69 }
el19tb 55:b17b9931c010 70
el19tb 55:b17b9931c010 71 void run_rect_params()
el19tb 55:b17b9931c010 72 {
el19tb 55:b17b9931c010 73 test_rec_paramaters(5, 48-4*5, 'S');
el19tb 55:b17b9931c010 74 test_rec_paramaters(6, 48-4*6, 'B');
el19tb 55:b17b9931c010 75 test_rec_paramaters(7, 48-4*7, 'T');
el19tb 55:b17b9931c010 76 }
el19tb 55:b17b9931c010 77
el19tb 55:b17b9931c010 78 void run_row_func()
el19tb 55:b17b9931c010 79 {
el19tb 55:b17b9931c010 80 test_row_func(6, 48-4*6);
el19tb 55:b17b9931c010 81 test_row_func(7, 48-4*7);
el19tb 55:b17b9931c010 82 test_row_func(8, 48-4*8);
el19tb 55:b17b9931c010 83 test_row_func(9, 48-4*9);
el19tb 55:b17b9931c010 84 }