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
EnemySpawner/EnemySpawner.h
- Committer:
- adat80
- Date:
- 2019-05-08
- Revision:
- 6:f06ce4cf068a
- Parent:
- 3:97cd7b3d89d0
File content as of revision 6:f06ce4cf068a:
#ifndef ENEMYSPAWNER_H #define ENEMYSPAWNER_H #include "mbed.h" #include "Gamepad.h" #include "Enemy.h" /** EnemySpawner Class @author Adam Jones, University of Leeds @brief Creates and controls the levels of the game @date April 2019 @brief Revision 1.0 @code #include "Enemy.h" #include "mbed.h" #include "Gamepad.h" int main() { //setup pointer to enemy array Enemy *_enemies; //setup level enemy spawner object EnemySpawner _level; //create level and return array of enemies int _levelNumber = 1 //integer level number _enemies = _level.init(_levelNumber); //returns number of enemies in level int numOfEnemies = _level.get_number_of_enemies() //updates level _level.update(_fps); } @endcode */ class EnemySpawner { public: EnemySpawner(); ~EnemySpawner(); /** * @brief Initialises the game level * @param level @details the number of the level of the game * @returns Enemy* @details a pointer to an array of enemy objects */ Enemy* init(int level); /** * @brief Updates to keep track of the time and tell indicidual enemies when to begin moving * @param fps @details the fps of the game */ void update(int fps); /** * @brief Gets the number of enemies in level * @returns number of enemies @details an integer value of the number of enemies in the level */ int get_number_of_enemies(); private: float _minTimeBetweenSpawns; float _timeIntoLevel; int _number_of_enemies; Enemy *_enemies; int _level; }; #endif