Ben Evans / Mbed 2 deprecated Defender_Game

Dependencies:   mbed

Committer:
evanso
Date:
Wed May 27 00:32:04 2020 +0000
Revision:
86:eecd168c3a23
Parent:
82:3211b31e9421
Fixed bugs in play game and removed any excess included headers.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
evanso 33:7fedd8029473 1 #ifndef PEOPLE_H
evanso 33:7fedd8029473 2 #define PEOPLE_H
evanso 33:7fedd8029473 3
evanso 82:3211b31e9421 4 // Included Headers ------------------------------------------------------------
evanso 33:7fedd8029473 5 #include "mbed.h"
evanso 34:85ccc16f24d2 6 #include "RandomMovement.h"
evanso 35:577c65bf914e 7 #include "CheckAlienCollision.h"
evanso 33:7fedd8029473 8
evanso 33:7fedd8029473 9 /** People class
evanso 33:7fedd8029473 10 * @brief Draws people and moves them if collected by aliens
evanso 33:7fedd8029473 11 * @author Benjamin Evans, University of Leeds
evanso 33:7fedd8029473 12 * @date May 2020
evanso 33:7fedd8029473 13 */
evanso 35:577c65bf914e 14 class People: public RandomMovement, public CheckAlienCollision {
evanso 33:7fedd8029473 15 public:
evanso 33:7fedd8029473 16 /** Constructor */
evanso 33:7fedd8029473 17 People();
evanso 33:7fedd8029473 18
evanso 33:7fedd8029473 19 /** Destructor */
evanso 33:7fedd8029473 20 ~People();
evanso 33:7fedd8029473 21
evanso 33:7fedd8029473 22 /** Initalises Alien
evanso 33:7fedd8029473 23 * @param position_x_start @details Random x start pos of people
evanso 82:3211b31e9421 24 * @param pad @detials Gamepad object
evanso 33:7fedd8029473 25 */
evanso 33:7fedd8029473 26 void init(Gamepad &pad, int position_x_start);
evanso 33:7fedd8029473 27
evanso 33:7fedd8029473 28 /** Draws the people
evanso 33:7fedd8029473 29 * @param lcd @details N5110 object
evanso 82:3211b31e9421 30 * @param d_ @details joystick direction
evanso 82:3211b31e9421 31 * @param map_length @details length of the map
evanso 82:3211b31e9421 32 * @param position_x_map_ @details x posisition that map starts
evanso 33:7fedd8029473 33 */
evanso 34:85ccc16f24d2 34 void draw_people(N5110 &lcd, Direction d_, int map_length_,
evanso 34:85ccc16f24d2 35 int position_x_map_);
evanso 33:7fedd8029473 36
evanso 33:7fedd8029473 37 // Accessors and mutators --------------------------------------------------
evanso 34:85ccc16f24d2 38
evanso 34:85ccc16f24d2 39 /** Gets alien collision flag
evanso 34:85ccc16f24d2 40 * @return alien_collision_flag
evanso 34:85ccc16f24d2 41 */
evanso 34:85ccc16f24d2 42 bool get_alien_collision_flag();
evanso 33:7fedd8029473 43
evanso 33:7fedd8029473 44 private:
evanso 33:7fedd8029473 45 // Function prototypes -----------------------------------------------------
evanso 34:85ccc16f24d2 46
evanso 34:85ccc16f24d2 47 /** Stops the people from moving off the edge of the map and moves
evanso 34:85ccc16f24d2 48 * people if the map loops
evanso 34:85ccc16f24d2 49 * @param map_length_@details : length of the map
evanso 34:85ccc16f24d2 50 * @param position_x_map_ @detials : the drawing start posisiton of the
evanso 34:85ccc16f24d2 51 * map
evanso 33:7fedd8029473 52 */
evanso 34:85ccc16f24d2 53 void off_screen_x_y_checker(int map_length_, int position_x_map_);
evanso 33:7fedd8029473 54
evanso 82:3211b31e9421 55 /** Move alien to top of screen if collision with alien */
evanso 36:27aa597db3d2 56 void collision_with_alien();
evanso 36:27aa597db3d2 57
evanso 33:7fedd8029473 58 // Variables ---------------------------------------------------------------
evanso 34:85ccc16f24d2 59
evanso 34:85ccc16f24d2 60 /** People movement counter */
evanso 34:85ccc16f24d2 61 int people_move_counter_;
evanso 33:7fedd8029473 62
evanso 33:7fedd8029473 63 };
evanso 33:7fedd8029473 64
evanso 33:7fedd8029473 65 #endif