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

Test.cpp

Committer:
el19tb
Date:
2020-05-26
Revision:
55:b17b9931c010

File content as of revision 55:b17b9931c010:

#include "Test.h"

/** TEST FROG CLASS */

/** Function that checks whether Frog has respawned in the right
 *  position
 */
bool test_frog_reset(float expect_value_x, float expec_value_y)
{
    Frog test_frog((84/2)-6/2, 48-4, 6); // test a frog object
    //printf("Frog reset x pos: %d,%d", x, y);
    if(test_frog.x == expect_value_x && test_frog.y == expec_value_y){
        //printf("FROG TEST PASSED");
        return true;
    } else {
        //printf("FROG TEST FAILED, %d", test_frog.x);
        return false;
    }
}

void run_frog_test()
{
    test_frog_reset((84/2)-6/2, 48-4);
    test_frog_reset((64/2)-6/2, 24-4);
    test_frog_reset((32/2)-6/2, 12-4);
}

/** TEST OBJECT CLASS */

/** Returns true if the input row will give the correct y pos */
bool test_row_func(int row, int object_y_coord)
{
    Object test_object;
    printf("Object row test: %d", row);
    if(test_object.object.y == object_y_coord){
      //  printf("OBJECT TEST PASSED");
        return true;
    } else {
       // printf("OBJECT TEST FAILED, %d", row);
        return false;
    }
}

/** function tests that the object class creates the rectangle correcly */
bool test_rec_paramaters(int x, int y, char c)
{
    Object test_object;
    if(test_object.rectangle.right_side == (x + test_object.width) &&
    test_object.rectangle.bottom == y + test_object.height
    && test_object.rectangle.up == test_object.object.y){
        //printf("OBJECT TEST PASSED");
        return true;
    } else {
        //printf("OBJECT TEST FAILED, %d, %d, object type: ", x, y, c);
        return false;
    }
}

bool test_speed_funcs(int dir)
{
    Object test_object;
    if(test_object.object.dir == dir){
        //printf("OBJECT TEST PASSED");
        return true;
    } else {
        //printf("OBJECT TEST FAILED, %d", dir);
        return false;
    }
}

void run_rect_params()
{
    test_rec_paramaters(5, 48-4*5, 'S');
    test_rec_paramaters(6, 48-4*6, 'B');
    test_rec_paramaters(7, 48-4*7, 'T');
}

void run_row_func()
{
    test_row_func(6, 48-4*6); 
    test_row_func(7, 48-4*7); 
    test_row_func(8, 48-4*8); 
    test_row_func(9, 48-4*9); 
}