Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Level/Level.h
- Committer:
- joshdavy
- Date:
- 2019-05-06
- Revision:
- 11:db27d3838514
- Parent:
- 9:96969b1c6bde
- Child:
- 12:5549a299d41e
File content as of revision 11:db27d3838514:
#ifndef LEVEL_H
#define LEVEL_H
#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"
#include "Bitmap.h"
#include "LevelDefinitions.h"
struct MovingBlock {
int index;
int distance;
int initial_pos;
bool extending;
};
const int goalMap[11][6] = {
{0,1,0,0,0,0},
{0,1,0,0,0,0},
{0,1,1,0,0,0},
{0,1,1,1,1,0},
{0,1,1,1,1,1},
{0,1,1,1,1,0},
{0,1,1,0,0,0},
{0,1,0,0,0,0},
{0,1,0,0,0,0},
{0,1,0,0,0,0},
{1,1,1,1,0,0}
};
/*Level Class*/
class Level {
public:
Level();
~Level();
void init(Block blocks [],
int number_of_blocks,
Vector2D goal,
MovingBlockDefinition moving_blocks[],
int number_of_moving_blocks);
void update_moving_blocks();
void render(N5110 &lcd);
void declare_moving_block(int index,bool extending,int distance);
Block * get_blocks();
int get_number_of_blocks();
Vector2D get_goal();
private:
Block _blocks [20] ;
int _number_of_blocks;
int _number_of_moving_blocks;
Vector2D _goal;
MovingBlock _moving_blocks [10];
};
#endif