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.
Dependencies: mbed
Miner/Sprites.h
- Committer:
- el17arm
- Date:
- 2019-04-10
- Revision:
- 31:ed5f7f15a1ed
File content as of revision 31:ed5f7f15a1ed:
#ifndef SPRITES_H
#define SPRITES_H
#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"
const int miner_right[24] = {
1,1,1,
1,1,0,
1,1,1,
0,1,0,
1,1,1,
1,1,1,
0,1,0,
0,1,1,
};
const int miner_left[24] = {
1,1,1,
0,1,1,
1,1,1,
0,1,0,
1,1,1,
1,1,1,
0,1,0,
1,1,0,
};
const int enemy[15] = {
1,1,1,
1,0,1,
1,1,1,
0,1,0,
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,
};
const int solid_block[9] = {
1,1,1,
1,0,1,
1,1,1,
};
struct enemies {
bool eflag[5];
double ex[5];
double ey[5];
int counter[5];
int distance[5];
};
class Sprites
{
public:
Sprites();
~Sprites();
void miner_init(int x, int y);
void miner_move(Direction d, N5110 &lcd);
void miner_draw(N5110 &lcd);
void miner_gravity(N5110 &lcd);
void miner_jump(N5110 &lcd, Gamepad &pad);
void miner_land(N5110 &lcd);
void enemy_init(int i, int x, int y, int d);
void enemy_move(int i, double v, N5110 &lcd);
bool enemy_collision(int i);
void key_collect(int k, int x, int y, N5110 &lcd, Gamepad &pad);
int keys_collected();
Vector2D get_pos();
private:
int _direction;
bool _gravity;
bool _jump;
int _y;
int _x;
bool _j_flag;
int _j_counter;
Key _key
enemies _enem;
};
#endif