Su 200943147

Dependencies:   Gamepad N5110 mbed

Engine/Engine.cpp

Committer:
GS00
Date:
2017-04-21
Revision:
2:84e6975dd4b2
Parent:
0:444b4d0a113d

File content as of revision 2:84e6975dd4b2:


void Engine::CollisionCheck()
{
    for(int u=0; u<84; u++) {
        for(int o=0; o<48; o++) {
            if(array[u][o]==1) {
                if(fill[u][o+1]==1) {
                    z=1;
                }
            }
            if(fill[u][o]==1) {
                if(array[u+1][o]==1) {
                    v=1;
                }
            }
            if(fill[u+1][0]==1) {
                if(array[u][o]==1) {
                    p=1;
                }
            }
        }
    }
}

void Engine::Drop()
{
    if(z==1) {
        y=y;
    } else {
        y=y+1;
        z=0;
    }

}

void Engine::Movement(Direction d)
{
    Direction d = joystick.get_direction();

    if(d == W) {
        if(v==1) {
            x=x;
            v=0;
        } else {
            x=x-1;
        }

    } else if(d == E) {
        if(p==1) {
            x=x;
            p=0;
        } else {
            x=x+1;
        }
    }
}