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
Gameengine/Gameengine.h
- Committer:
- el17arm
- Date:
- 2019-04-24
- Revision:
- 45:bad704c546d4
- Parent:
- 44:e29458976114
- Child:
- 46:de3462ad5aef
File content as of revision 45:bad704c546d4:
#ifndef GAMEENGINE_H
#define GAMEENGINE_H
#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"
#include "Sprites.h"
#include "Levels.h"
/** Gameengine Class
@author Andrew Milner University of Leeds
@brief Builds all levels and sets all default values. Updates all game settings
and contains functions for all game conditions
@date April 2019
*/
class Gameengine
{
public:
Gameengine();
~Gameengine();
/**
* @brief Reads direction the player is moving
* @details Uses getdirection() function from Gamepad library
*/
void read_direction(Gamepad &pad);
void update(N5110 &lcd, Gamepad &pad);
void game_init();
void draw_l1(N5110 &lcd, Gamepad &pad);
void draw_l2(N5110 &lcd, Gamepad &pad);
void draw_l3(N5110 &lcd, Gamepad &pad);
void lose_life(Gamepad &pad, N5110 &lcd);
bool game_over();
void next_level(N5110 &lcd);
bool trap_death(N5110 &lcd);
void key_draw(N5110 &lcd,Gamepad &pad);
void blocks(N5110 &lcd);
bool enemies(N5110 &lcd);
void key_reinit();
int oxygen_leds();
int lives_leds();
void get_score(N5110 &lcd);
bool game_complete(N5110 &lcd);
private:
int _level;
int _lives;
double _x;
double _y;
int _distance;
int _turn_flag;
int _counter;
bool _enem_flag;
int _five_keys;
bool _key_reinit;
bool level_exit(N5110 &lcd);
int _oxy_state;
int _life_state;
float _total_time;
float _time_total;
float _time;
Sprites _sprites;
Direction _d;
Levels _lev;
Timer _t;
};
#endif