ELEC2645 (2018/19) / Mbed 2 deprecated el17arm

Dependencies:   mbed

Levelengine/Levelengine.h

Committer:
el17arm
Date:
2019-04-08
Revision:
25:7fb1b6fa9137
Parent:
24:9c7aca60e374

File content as of revision 25:7fb1b6fa9137:

#ifndef Levelengine_H
#define Levelengine_H

#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"

const int big_block[9] =   {
        1,1,1,
        1,0,1,
        1,1,1,
    };
    
const int key[12] =   {
        1,1,0,0,
        1,0,1,1,
        1,1,0,1,
    };

const int key_collected[12] =   {
        0,0,0,0,
        0,0,0,0,
        0,0,0,0,
    };
    
const int spike[9] =   {
        
        1,1,1,
        0,1,0,
        1,1,1,
    };
    
const int door[30] = {
        
        1,1,1,1,1,
        1,0,1,0,1,
        1,1,0,1,1,
        1,0,1,0,1,
        1,1,0,1,1,
        1,0,1,0,1,
};    

typedef struct {
    bool key[5];
    } Key;

class Levelengine
{
public:

    Levelengine();
    ~Levelengine();
    
    void soft_blocks(int x, int y, N5110 &lcd);
    bool solid_block(int x, int y, N5110 &lcd);
    void key_collect(int k, int x, int y, N5110 &lcd, Gamepad &pad);
    bool trap(int x, int y, N5110 &lcd);
    bool exit(int x, int y, N5110 &lcd);
    
    int keys_collected();

private:

    int _collision;
    bool key_collect1; //ensures loop is only executed once and key does not reappear
    bool key_collect2; 
    bool key_collect3; 
    bool key_collect4; 
    bool key_collect5;
    int _keys;
    Key _k;  
    
    
};

#endif